Refresh the google auth manually through code
See original GitHub issueI am having an issue with finding out how to refresh the Google auth through code. The main problem is that after the 1 hour session has timed out then I start to get errors.
I have set isSignedIn
to true, but this doesn’t really help me since I am on a dashboard type of page and want it to refresh when an api call fails (using axios interceptor to do this). I would love to just try a refresh on the google auth when there is a 401 returned. I am already successfully doing this with my API and a 1 hour JWT, so it seems reasonable to use the same method for the google auth refresh. This kind of works, but according to other comments on the internet I should just do gapi.something.refreshToken
basically, but this doesn’t work with me because the gapi
is not available when I try to call it (probably due to the 401 errors causing the rest of the script not to load or something)
I was hoping this plugin would just kind of handle that for me, but it seems not. Any ideas I could try?
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top GitHub Comments
Yeah so I think I just got this working. I basically set up an axios interceptor to run and then call the custom hook from the interceptor once the gapi object is loaded back in.
I still think this is something the the package should make a lot easier to handle, but it seems my issue is solved for now.
Thanks for the help!