Firebase facebook login photo url signature expired

前端 未结 4 2320
星月不相逢
星月不相逢 2021-01-20 01:30

I\'m using Firebase (angularfire) and Facebook login in my APP to authenticate my users. However today I realized that the profile image URL had been expired, but the Fireba

4条回答
  •  独厮守ぢ
    2021-01-20 02:04

    I solved this by using the photoURL that can be found within: user.providerData[0].photoURL Where user is the user data returned on

    firebase.auth().onAuthStateChanged( user => {})
    

    And [0] is the index of the Authentication Provider of interest. In my case I only have Facebook authentication, thus the index is 0.

    Seems that this URL is somehow being updated... (maybe on user sign in?)

    Edit: It seems that the URL is indeed being updated on user sign in. So be aware that if the user is "remembered" by the browser, with this method the image will eventually expire, if the user isn't forced to sign in again before expiration.

提交回复
热议问题