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
{{ message }}
Repository navigation
Refresh_token_expires_in not getting from google OAuth token api by passing ServerAuthCode. #565
Describe the bug
I am getting a serverAuthCode which doesn't gives Refresh_token_expires_in from google Oauth token api call when user not checkmarked the ongoing access for google account.
User get prompted for google sign inand then scopes list will be shown to the user.
User will not select Ongoing access and select all required scopes, then click on continue.
Code side we will get serverAuthCode and we will use google Oauth token api to get refresh token.
We will get refresh token but not refresh_token_expires_in to know whether refresh token is long lived or not.
Expected behavior
As user has not selected ongoing access, we should be getting refresh_token_expires_in and it should be 15551999.
Environment
Device: iPhone 11
OS: 18.2.1
Browser: Internal browser(may be safari) launch by GIDSignIn
Additional context
Either you can expose refresh_token_expires_in from GIDSignIn response or can provide a serverAuthCode which helps in getting the same. I have tried with serverAuthCode got from android app and call google OAuth token api and that gives the refresh_token_expires_in.
I gave this a run on my end using our DaysUntilBirthday sample app, and received a refresh_token_expires_in value. This value is exposed under the additionalParameters field once we receive a token response here. The following is a screenshot of the refresh_token_expires_in value and its location on my end:
I am looking for the same, but it is not accessible outside the library.
One more thing i can't pass access_type=offline in GIDSignIn.sharedInstance.signIn(.....) function, so i can't get offline refresh token. So I need to call googleapi.com/oauth api along with serverAuthCode for getting a refresh token with offline access. Actually i need refersh_token_expires_in value in that api call response, but i never get there.
Best way is to pass access_type=offline in GIDSignIn.sharedInstance.signIn(.....) call and expose refresh_token_expires_in outside the library(Public access). This way i can get refresh token and refresh_token_expires_in.
Could you please update library functions with above requirement in next version?
We'll follow up separately with regards to access_type=offline. Generally speaking, though, that bit should be happening on your backend, not the client.
The expiration date which you are pointing out above is coming as empty/null for me, So it has no usage for me.
If there is any other way to get offline refresh_token and refresh_token_expires_in, Please let me know the steps.
Other possibility to get above data is to pass access_type=offline in GIDSignIn.sharedInstance.signIn(.....) call and expose refresh_token_expires_in outside the library(Public access). This way i can get refresh token and refresh_token_expires_in.
Re: the expiration date - mea culpa! We did not add that when a handful of Google APIs added support for refresh token rotation. That's being added in the PR linked above, and we'll close this issue once it's complete.
That being said, I don't know if it's going to solve your issue - what you are seeing is expected behaviour for ~most refresh tokens, which are long-lived. Your user has not selected ongoing access; so, when your attempt to authenticate with the access token fails, you'd then attempt to exchange the refresh token. If your refresh token has not expired, you'll get a new access token. If it has expired, you'll need the user to re-authenticate.
Checking the refresh token expiration will save your app (and Google's server) a network roundtrip, but it's not going to give your app offline access - by leaving "Ongoing Access" unchecked, the user has indicated that they don't want your app to have offline access :)
Activity
brnnmrls commentedon Dec 26, 2025
Hey, thanks for your issue!
I gave this a run on my end using our DaysUntilBirthday sample app, and received a

refresh_token_expires_invalue. This value is exposed under theadditionalParametersfield once we receive a token response here. The following is a screenshot of therefresh_token_expires_invalue and its location on my end:Is this something you're looking for?
anuragverse14 commentedon Jan 17, 2026
I am looking for the same, but it is not accessible outside the library.
One more thing i can't pass access_type=offline in GIDSignIn.sharedInstance.signIn(.....) function, so i can't get offline refresh token. So I need to call googleapi.com/oauth api along with serverAuthCode for getting a refresh token with offline access. Actually i need refersh_token_expires_in value in that api call response, but i never get there.
Best way is to pass access_type=offline in GIDSignIn.sharedInstance.signIn(.....) call and expose refresh_token_expires_in outside the library(Public access). This way i can get refresh token and refresh_token_expires_in.
Could you please update library functions with above requirement in next version?
w-goog commentedon Jan 23, 2026
The expiration date of the tokens is available on the client here. That being said, you'll ideally be calling the
refreshTokensIfNeededfunction on the user - https://developers.google.com/identity/sign-in/ios/backend-auth#send-the-id-token-to-your-serverWe'll follow up separately with regards to
access_type=offline. Generally speaking, though, that bit should be happening on your backend, not the client.anuragverse14 commentedon Jan 25, 2026
The expiration date which you are pointing out above is coming as empty/null for me, So it has no usage for me.
If there is any other way to get offline refresh_token and refresh_token_expires_in, Please let me know the steps.
Other possibility to get above data is to pass access_type=offline in GIDSignIn.sharedInstance.signIn(.....) call and expose refresh_token_expires_in outside the library(Public access). This way i can get refresh token and refresh_token_expires_in.
Expose refresh token expiration date
w-goog commentedon Feb 5, 2026
Re: the expiration date - mea culpa! We did not add that when a handful of Google APIs added support for refresh token rotation. That's being added in the PR linked above, and we'll close this issue once it's complete.
That being said, I don't know if it's going to solve your issue - what you are seeing is expected behaviour for ~most refresh tokens, which are long-lived. Your user has not selected ongoing access; so, when your attempt to authenticate with the access token fails, you'd then attempt to exchange the refresh token. If your refresh token has not expired, you'll get a new access token. If it has expired, you'll need the user to re-authenticate.
Checking the refresh token expiration will save your app (and Google's server) a network roundtrip, but it's not going to give your app offline access - by leaving "Ongoing Access" unchecked, the user has indicated that they don't want your app to have offline access :)