예제 #1
0
        public Uri BuildPageAuthUri()
        {
            HaravanAPIAuthorizer authorizer = GetAuthorizer();
            var url = authorizer.GetAuthorizationURL(new string[] { "openid", "profile", "email", "org", "userinfo", "web.read_contents", "web.write_contents", "web.read_themes", "web.write_themes", "grant_service" });

            return(new Uri(url, UriKind.Absolute));
        }
예제 #2
0
        public async Task <Tuple <string, string> > GetAccessToken(string code)
        {
            HaravanAPIAuthorizer      authorizer = GetAuthorizer();
            HaravanAuthorizationState authState  = authorizer.AuthorizeClient(code);

            if (authState != null && authState.AccessToken != null)
            {
                return(new Tuple <string, string>(authState.AccessToken, authState.ShopName));
            }
            return(new Tuple <string, string>("", ""));
        }
예제 #3
0
        public void AuthorizerTest()
        {
            var redirect = "http://localhost:8000/finalize";

            var authorizer = new HaravanAPIAuthorizer("mrshop", "317d665f79f81602907ea633c125e6a9", "41469500e03a9ffd9d7b9df38a5710cd", redirect);

            var urlauthorize = authorizer.GetAuthorizationURL(new string[] { "read_products", "write_products" });

            var code = "7a42ebd12bf6498a915fbb368b6bbb0518ed730ea2184d4197b0cb1fa39e2554";

            var authorizeState = authorizer.AuthorizeClient(code);
        }