-
Notifications
You must be signed in to change notification settings - Fork 208
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
Issue with OAuth2 Scope implementation (Scope has changes from..) #287
Comments
The scope appears to be reverting to the default scope between the first and second view. Is there a possibility the cache is being changed by another part of your code in-between? The results are consistent with |
I have the same problem. Whereas it also gives me the access_tokens and refresh_tokens |
@iamsarthakjoshi I resolved it with creating new credentials object in callback instead of passing old state |
I am having the same issue, however the OAuth2Credentials scope is being defined correctly. The scope in both instances (start_auth_view and callback) is: However it gives the following error: If you need any more contextual information please let me know. Any help in resolving this other than drastically increasing the requested scope would be appreciated. |
I have figured out the issue. The application you are connecting to has previously granted the user a much larger scope than you are now requesting. Xero does not reset the scope history of an account / application relationship when disconnecting that application from the organisation. As a result, the only way to reduce the scope granted by an application to a particular account is to delete the application from the Xero Developer portal and link to a new one. The Xero Support team told me that scopes are accumulative and if you have ever requested a larger scope previously it will always return that scope in the access token being granted. Considering this, the only way to receive the exact scope you are expecting is to:
Once you have done this, the scope you receive will be as expected. If you don't mind that the scope has changed during the request, you can add the following to your settings.py file: This will tell the OAuth requests lib to not care about a changing scope during the request. |
Thanks for sharing the solution! |
Glad the solution could help, I've been on and off trying to figure this out for a while, hopefully it will save others time in the future |
Is there something we can do in PyXero to make this "handled" better? (Or is this resolved and I can close it?) |
I think it's resolved as there is nothing you can really do on your end, other than maybe providing more information on this particular problem in your docs? |
I don't understand this problem. I haven't tried changing the scopes in the process, but while verifying with request_uri (after the two-factor authentication) the problem appears every time saying "Scope has changed from...to ..."
Any help is kindly appreciated. :)
Thank you.
The text was updated successfully, but these errors were encountered: