Exemplo n.º 1
0
    public async void GetAccessTokenAsync()
    {
        Assert.That(_clientId, Is.Not.Null.Or.Empty);
        Assert.That(_clientSecret, Is.Not.Null.Or.Empty);
        Assert.That(_authorizationResult, Is.Not.Null);

        var provider = new AccessTokenProvider(_clientId, _clientSecret);
        var handle   = await provider.ProvideAsync(_authorizationResult.AuthorizationCode, _authorizationResult.CodeVerifier, _authorizationResult.RedirectUri);

        if (!handle.IsFailed)
        {
            _accessTokenResult = handle.Result;
        }

        Debug.Log($"Access Token: {_accessTokenResult.AccessToken}");
    }