how to keep google login session alive till user manually logout in ionic 4 + angular mobile app?

482 Views Asked by At

I created ionic4 application in which i am trying to backup user data in user's google drive. For that I implemented google login with google drive scope, but accessToken gets expired after some time. Application don't have any backend services. So I want to schedule backup to google drive in my app for that i need to keep google login token alive. Can we do that using cordova google plus plugin ?

Can you please add example of how to keep google session alive ?

I am getting following response after google login.

accessToken: "My-access-token"

displayName: "Abc xyz"

email: "[email protected]"

expires: 1564411539

expires_in: 3191

familyName: "Abc"

givenName: "Xyz"

idToken: "my-id-token"

imageUrl: "my-gmail-profile-pic-utl"

serverAuthCode: "my-login-servcer-auth-code"

userId: "1608XXXXXXXXXXXX030XX"

1

There are 1 best solutions below

2
Bhavin Hirpara On

So i solved this issue. You can use firebase with google login and firebase will automatically refresh your access_token when it expires.