-
Notifications
You must be signed in to change notification settings - Fork 314
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
Credentials jwt "aud" #464
Comments
Hi @nikoloutsa, Could you let us know what you're looking to accomplish by overriding the default token URI? If you need to use a |
Hi so my problem is not how to set the
and not using the custome Hope this is more clear thank you. |
Ah I see. You're correct, there is no way to make the Is there a technical reason preventing you from allowing the auth request to be made directly to the Google OAuth2 endpoint? |
actually yes, i have deployed my code on a node that has no internet access, but I can send requests via a proxy as I said (https://example.com/oauth2/token) that would forward the requests to "https://oauth2.googleapis.com/token" |
@nikoloutsa did you find a work around for it?. I too have the same problem forwarding requests through a proxy |
For my case the workaround was to hard-code the payload url inside: Just search for the
Not sure if this is the best fix, but for my cases seems to work flawlessly. |
Same happens to me, but in my case i wont use it in local environment, I need to deploy in App Engine application, so I can't make that change. It is worth noting that in my credentials file, the variable "token_uri" has the value https://accounts.google.com/o/oauth2/token, that is the same value that the "audience" is supposed to have. Is there any alternative solution to be able to deploy in productive environments? may be related to the credential creation date? the one I am using was created in 2016. Regards. |
Hi, I have found my own solution, and it is to change the value of the "token_uri" to https://oauth2.googleapis.com/token. I guess the google.oauth2 library expects this value instead of https://accounts.google.com/o/oauth2/token, and I noticed this because when creating a new service account for testing, the value of "token_uri" was https://oauth2.googleapis.com/token. It seems that old service accounts are not created in the same way as the current ones, and therefore, if you use deprecated libraries like oauth2client the value of "token_uri" should be https://accounts.google.com/o/oauth2/token and if you use the google.oauth2 library the value of "token_uri" should be https://oauth2.googleapis.com/token. I hope this may help someone in the future, while someone more knowledgeable weighs in on the matter. Kind regards. |
Hello I am trying to authenticate with the
Credentials
class and aservice_account
file.and a proxy for the google oauth token endpoint.
So by setting the
token_uri
in theservice_account
fileafter authenticating
I get an JWT grant error “Invalid JWT: Failed audience check.”
By inspecting the auth library the JWT "aud" is set to the token_uri,
google-auth-library-python/google/oauth2/service_account.py
Line 317 in 37141e4
and there is no option to set it to the default
as suggested in the documentation
Is this the expected behaviour? If yes how should I use my proxy to authenticate.
Thank you
The text was updated successfully, but these errors were encountered: