Beispiel #1
0
        /// <inheritdoc/>
        public async Task <bool> AuthenticationByCode(string code, string redirectUrl)
        {
            var form = new Dictionary <string, string>
            {
                { "grant_type", "authorization_code" },
                { "code", code },
                { "client_id", clientId },
                { "client_secret", clientSecret },
                { "redirect_uri", redirectUrl }
            };

            authTokens = await http.PostForm <AuthToken>(TokenUrl, form).ConfigureAwait(false);

            if (authTokens == null)
            {
                return(false);
            }

            await CallOnTokenUpdate(authTokens.access_token, authTokens.refresh_token, DateTime.UtcNow.AddSeconds(authTokens.expires_in));

            await Account.GetEndpoint().ConfigureAwait(false);

            return(true);
        }