2021年4月30日星期五

firebase oauth2 accessToken useless

In firebase we can use signInWithPopup and get our auth provider access token by credential.accessToken. We can only get this accessToken one time after login. But this access token is expired in one hour! And we need to force user to login again to get access token. What the point of this completely useless access token user experience? If we cant use it anyway.

update: I'm developing Chrome Extension with Firebase and trying to add Google Calendar support. And I spent already several days but didn't found solution. first GAPI is not working in Chrome Extension. I tried to use signInWithPopup and make it with REST calls but google.com oauth2 access token in firebase is expiring after one hour and there is no way to refresh it silently. This is all Google products and why they are so hard to make work together?

update2:

provider = new firebase.auth.GoogleAuthProvider();  provider.addScope('https://www.googleapis.com/auth/calendar.events');    const result = await firebase.auth().signInWithPopup(provider)  var credential = result.credential;    // Saving **credential** somewhere for later use it in REST calls to` https://www.googleapis.com/calendar/v3/users/me/calendarList  

PROBLEM this access token is expired after ONE hour.

https://stackoverflow.com/questions/67313138/firebase-oauth2-accesstoken-useless April 29, 2021 at 03:48PM

没有评论:

发表评论