Example #1
0
        public TokenResponse RefreshToken(string refreshToken)
        {
            urlBase = string.Format("{0}{1}", (ServiceLocator.Instance.Get <BaseSeusSettings>() ?? new SeusLabSettings()).BaseSeusURL, accountRootEndpoint);
            fullUrl = string.Format("{0}{1}", urlBase, TokenEndPoint);

            var headers = new Dictionary <string, string>
            {
                { "Accept", ContentTypeJson }
            };

            string body = $"grant_type=refresh_token&refresh_token={refreshToken}";

            var repositoryBase = new ClientJsonResponse <TokenResponse>(httpClientHandler, storage);

            return(repositoryBase.ConsumeRestService(body, fullUrl, HttpMethod.Post, ContentTypeEncoded, headers, false));
        }
Example #2
0
        public TokenResponse Token(TokenRequest tokenRequest)
        {
            urlBase = string.Format("{0}{1}", (ServiceLocator.Instance.Get <BaseSeusSettings>() ?? new SeusLabSettings()).BaseSeusURL, accountRootEndpoint);
            fullUrl = string.Format("{0}{1}", urlBase, TokenEndPoint);

            var headers = new Dictionary <string, string>
            {
                { "Accept", ContentTypeJson }
            };

            string body = $"grant_type=authorization_code&code={tokenRequest.AutenticateCode}&redirect_uri={WebUtility.UrlEncode(UrlRedirect)}&client_id={(ServiceLocator.Instance.Get<BaseSeusSettings>() ?? new SeusLabSettings()).SeusClientId}&code_verifier={tokenRequest.CodeChallenge}";

            var repositoryBase = new ClientJsonResponse <TokenResponse>(httpClientHandler, storage);

            return(repositoryBase.ConsumeRestService(body, fullUrl, HttpMethod.Post, ContentTypeEncoded, headers));
        }