Kubessandra / react-google-calendar-api

An api to manage your google calendar

Repository from Github https://github.comKubessandra/react-google-calendar-apiRepository from Github https://github.comKubessandra/react-google-calendar-api

Refresh or save Token to localStorage

totoluto opened this issue · comments

Is there a way to access the token or safe the token to the localStorage and retrieve it when accessing the website?
And if yes is there a way to refresh the token when it has expired?
I shouldn't be the first one to face that problem. How did you solve it? Are you always logging back in when accessing the website?
Thanks for the greate package btw.

@totoluto

By default, OAuth 2.0 access tokens are valid for a maximum of 1 hour (3,600 seconds).

https://developers.google.com/identity/protocols/oauth2#expiration

If you want to refresh the token, call again handleAuthClick i think

@OchotaDariusz
Thank you, and what about saving the token or session?
Is there any use to it?

I think there's possibility to do that but you'll have to modify code to add getter for tokenClient field. But how about refreshing token then you should read google docs about that. Good luck :)

Thank you!