google / GoogleSignIn-iOS

Enables iOS and macOS apps to sign in with Google.
https://developers.google.com/identity/sign-in/ios
Apache License 2.0
506 stars 201 forks source link

Refresh tokens on button tap and tokens are within 10 minutes of expiration or expired. #462

Closed brnnmrls closed 2 months ago

brnnmrls commented 3 months ago

The following ensures the user is not presented dull token information (i.e. token has expired). Opening the app for the first time and tapping on "Verify My Age" will fetch new tokens and display that information to the user. Following taps on the same button will check if the access token is within 10 minutes of expiration or expired (similar to -[GIDSignIn maybeFetchToken:]). If the access token is near expiration or expired, then it'll be refreshed using the result object's refresh token. Otherwise, if the token is not near expiration, then VerificationView will display the current tokens' information.