Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RevokeRefreshToken does not revoke token #204

Closed
dstorrence opened this issue Jan 4, 2019 · 7 comments
Closed

RevokeRefreshToken does not revoke token #204

dstorrence opened this issue Jan 4, 2019 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@dstorrence
Copy link

When attempting to revoke the refresh token with OAuth2ProviderForApplications.RevokeRefreshToken(), I do not receive any errors, yet the application remains in the permissions list (https://myaccount.google.com/permissions)

According to the method description, the token must be generated in "Offline Mode". When using the provider OAuth2ProviderForApplications, the default value for IsOffline is "true" so that suggests that it's already set to offline.

I have been using the same code for several months with success, but it didn't fail until I recently updated to the latest libraries.

Please let me know if more information is required.

@dstorrence
Copy link
Author

I also wanted to mention a few things:

  1. If I execute the method for a refresh token, then attempt to execute on the same token again, I receive an error that it has already been revoked.

  2. My two scenarios for testing have been to include the Access Token, as well as exclude it. In both scenarios, it's the same result, where my credentials remain in the permissions list.

  3. After I upgraded to the newest versions of the libraries, I changed the provider to begin using the "Config" object for the credentials. I've confirmed that the Refresh and Access tokens appear in the "Config" object, as well as the properties RefreshToken and AccessToken (when appropriate)

@groverp93
Copy link

groverp93 commented Jan 4, 2019

I am also facing the same issue.
Please suggest the solution for this problem.

@jradcliff jradcliff added the investigation This issue needs further investigation before working on a fix. label Jan 14, 2019
@jradcliff
Copy link
Member

@christopherseeley , assigning over to you. Could please take a look?

Thanks,
Josh

@christopherseeley christopherseeley added bug Something isn't working and removed investigation This issue needs further investigation before working on a fix. labels Jan 31, 2019
@christopherseeley
Copy link
Member

Fixed in 24.4.0

@dstorrence
Copy link
Author

dstorrence commented Feb 12, 2019

@christopherseeley Is there a new way to revoke? Now I receive the following error, with my existing code:

"Failed to revoke refresh token."

Still using the method Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RevokeRefreshToken()

I build the AdWordsAppConfig object and pass it in to a new OAuth2ProviderForApplications as the parameter, before I issue the RevokeRefreshToken method.

The Error property of the exception has the following:

{Error:"invalid_request", Description:"Bad Request", Uri:""}

@dstorrence
Copy link
Author

Here's the full stack trace:

at Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RevokeRefreshToken()
[Redacted - My method]
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RevokeRefreshToken(String refreshToken)
at Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RevokeRefreshToken()
at Google.Apis.Auth.OAuth2.Flows.GoogleAuthorizationCodeFlow.d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Google.Apis.Auth.OAuth2.UserCredential.d__17.MoveNext()

@jradcliff @christopherseeley

@dstorrence
Copy link
Author

@jradcliff @christopherseeley

Found the issue. The method now requires the access and refresh tokens to be supplied. Previously, it worked with just the refresh token.

Code adjusted and I'm able to successfully revoke, now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants