You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context:
You can not pass a rawNonce to signInWithGoogle.
When using signInWithGoogle on Android, the returned idToken does not return a nonce. This makes sense because a rawNonce is not passed in.
The same exact code when run on iOS, returns a hashed nonce in the idToken. This does not make sense since we can not pass in a nonce. Where is the nonce coming from?
In the case of Google Sign-In for iOS and macOS, nonce values are being generated by AppAuth and included with the auth request. During ID token validation, the nonce value of the ID token is then verified using the originally generated value.
@petea Oh interesting.
Now if I want to send this JWT with the hashed nonce, how can I get the original nonce used so that i can verify this myself on the backend?
How can I get the originally generated value?
I also see that the comment says
@discussion If this value is not explicitly set, this library will automatically add nonce and perform appropriate validation of the nonce in the ID Token.
The nonce generated by AppAuth isn't available via the Google Sign-In API surface. Currently, the recommended approach to server-side validation of the ID token doesn't include validation of the nonce.
Is there no way to explicitly set this value?
AppAuth allows you to provide a specific nonce, if desired. However, Google Sign-In does not expose this capability in its API surface.
Reacted by Gradyn Wursten, Hristo Gochev, Cooper Hanessian and Muhammad Arman Maulana
@DanMossa, PRs are always welcome. Can you provide more detail on the specific use cases that are blocked here? Are they all related to server-side verification of the nonce?
@toshi0383 is the existing automatic client-side nonce generation / validation not adequate for your needs?
@petea We generate nonce in our server-side, so we need manual way to do this.
I have a brand new branch for this, so will tackle in a PR in a few minutes!
Reacted by YuyaOkumura, Tyler and Vadims Casecnikovs (Vadim Chashechnikov)
Hi all! Many apologies for the delay. Thanks for your patience.
Would you be able to share more information about your use-case? It seems to deviate from the typical use case where the nonce is generated by the client.
In general, it seems fine for GSI to provide an API to ingest a nonce to pass along to OIDAuthorizationRequest in AppAuth.
The nonce generated by AppAuth isn't available via the Google Sign-In API surface. Currently, the recommended approach to server-side validation of the ID token doesn't include validation of the nonce.
This is not true. The OIDC spec which Google follows explicitly states:
nonce
String value used to associate a Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authentication Request to the ID Token. If present in the ID Token, Clients MUST verify that the nonce Claim Value is equal to the value of the nonce parameter sent in the Authentication Request. If present in the Authentication Request, Authorization Servers MUST include a nonce Claim in the ID Token with the Claim Value being the nonce value sent in the Authentication Request. Authorization Servers SHOULD perform no other processing on nonce values used. The nonce value is a case sensitive string.
Please allow for people to be able to extract the nonce you send to Google.
Reacted by romain.gyh, kangming, Asen Lekov and Carlos Moises Arevalo
Additional note: If you're using Google Sign-In 8.1.0-vwg-eap-1.0.x to fix this issue, you should know that we are getting rid of these pre-releases soon. Please use official release Google Sign-In 9.0.0 instead.
This is a final reminder that these pre-releases will be removed very soon from GitHub and CocoaPods. If you haven't already, please migrate to the official 9.0.0 release, which is our stable, long-term solution.
Activity
petea commentedon Jun 13, 2022
In the case of Google Sign-In for iOS and macOS, nonce values are being generated by AppAuth and included with the auth request. During ID token validation, the nonce value of the ID token is then verified using the originally generated value.
DanMossa commentedon Jun 13, 2022
@petea Oh interesting.
Now if I want to send this JWT with the hashed nonce, how can I get the original nonce used so that i can verify this myself on the backend?
How can I get the originally generated value?
I also see that the comment says
Is there no way to explicitly set this value?
petea commentedon Jun 16, 2022
The nonce generated by AppAuth isn't available via the Google Sign-In API surface. Currently, the recommended approach to server-side validation of the ID token doesn't include validation of the nonce.
AppAuth allows you to provide a specific nonce, if desired. However, Google Sign-In does not expose this capability in its API surface.
DanMossa commentedon Jun 16, 2022
@petea
Oh I see, thanks for the clarification!
The lack of getting the raw nonce or specifying the raw nonce is blocking a few different users.
Would a PR to fix this be welcome in the future?
toshi0383 commentedon Oct 25, 2022
We need nonce support, too.
Apple and LINE supports this, so please consider.
We want to prevent Replay Attack.
petea commentedon Oct 27, 2022
@DanMossa, PRs are always welcome. Can you provide more detail on the specific use cases that are blocked here? Are they all related to server-side verification of the nonce?
@toshi0383 is the existing automatic client-side nonce generation / validation not adequate for your needs?
toshi0383 commentedon Oct 27, 2022
@petea We generate nonce in our server-side, so we need manual way to do this.
I have a brand new branch for this, so will tackle in a PR in a few minutes!
toshi0383 commentedon Oct 27, 2022
Done!
#244
mdmathias commentedon Jun 1, 2023
Hi all! Many apologies for the delay. Thanks for your patience.
Would you be able to share more information about your use-case? It seems to deviate from the typical use case where the
nonceis generated by the client.In general, it seems fine for GSI to provide an API to ingest a
nonceto pass along to OIDAuthorizationRequest in AppAuth.hf commentedon Jul 20, 2023
This is not true. The OIDC spec which Google follows explicitly states:
Please allow for people to be able to extract the nonce you send to Google.
SunilKividor commentedon Apr 18, 2024
@petea @toshi0383 can u help me setting up nonce in the google sign in package? Its an urgent usecase
toshi0383 commentedon Apr 24, 2024
@SunilKividor Hire someone and leave.
I have nothing to do with ur use case.
Stop mentioning us for nothing.
SunilKividor commentedon Apr 24, 2024
@toshi0383 Thankyou for the response. We have moved to google credential management for setting up authentication with nonce. I appreciate your time.
Massimiliano-solutiontech commentedon Apr 25, 2024
Any news on that? The only way to set the
nonceis to use AppAuth?toshi0383 commentedon Apr 26, 2024
FYI my fork is an option too. #244
We're using this in production without any issues.
vonovak commentedon Apr 28, 2024
I have opened a PR to support this: #402
GNUGradyn commentedon Jul 9, 2024
been a few months, any movement on this PR?
riderx commentedon Oct 4, 2024
Done here: #402
brnnmrls commentedon Jul 7, 2025
I want to call out here that 9.0.0 is released containing the fix for this issue. Thanks everyone for your involvement!
brnnmrls commentedon Jul 10, 2025
Additional note: If you're using Google Sign-In 8.1.0-vwg-eap-1.0.x to fix this issue, you should know that we are getting rid of these pre-releases soon. Please use official release Google Sign-In 9.0.0 instead.
brnnmrls commentedon Sep 4, 2025
Hey everyone!
This is a final reminder that these pre-releases will be removed very soon from GitHub and CocoaPods. If you haven't already, please migrate to the official 9.0.0 release, which is our stable, long-term solution.
Thanks!