Exemple #1
0
        public Uri BuildPageAuthUri(string shopUrl)
        {
            SapoAPIAuthorizer authorizer = GetAuthorizer(shopUrl);
            var url = authorizer.GetAuthorizationURL(new string[] { "read_content", "write_content", "read_themes", "write_themes" });

            return(new Uri(url, UriKind.Absolute));
        }
Exemple #2
0
        public async Task <string> GetAccessToken(string shopUrl, string code)
        {
            _log.InfoFormat("Sapo GetAccessToken: shopUrl = {0} , code = {1}", shopUrl, code);
            SapoAPIAuthorizer      authorizer = GetAuthorizer(shopUrl);
            SapoAuthorizationState authState  = authorizer.AuthorizeClient(code);

            _log.WarnFormat("Sapo GetAccessToken state: authState = {0}", authState);
            if (authState != null && authState.AccessToken != null)
            {
                return(authState.AccessToken);
            }
            return("");
        }