public void TestConstructor() { var request = new AuthorizationCodeTokenRequest(); Assert.Null(request.Code); Assert.Null(request.ClientId); Assert.Null(request.ClientSecret); Assert.Null(request.RedirectUri); Assert.That(request.GrantType, Is.EqualTo("authorization_code")); Assert.Null(request.Scope); }
public async Task<TokenResponse> ExchangeCodeForTokenAsync(string userId, string code, string redirectUri, CancellationToken taskCancellationToken) { var authorizationCodeTokenReq = new AuthorizationCodeTokenRequest { Scope = string.Join(" ", Scopes), RedirectUri = redirectUri, Code = code, }; var token = await FetchTokenAsync(userId, authorizationCodeTokenReq, taskCancellationToken) .ConfigureAwait(false); await StoreTokenAsync(userId, token, taskCancellationToken).ConfigureAwait(false); return token; }