I am using Firebase in my app and I allow users to login with Facebook. I can successfully access the logged in Facebook user with Auth.auth().
The problem that I am having now is that some profile pictures gives me a "URL signature expired". I would like to re-fetch the latest profile picture URL and update the logged in user, but I am not quite sure how I can achieve this.
I know that Facebook provides an URL to get the new profile picture image: http://graph.facebook.com/<facebook-id>/picture
Or I could also alternatively use the FBSDKGraphRequest to get the latest profile picture URL:
FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "picture"]).start(completionHandler: { _, result, error in
guard
error == nil,
let result = result as? [String: Any],
let picture = result["picture"] as? [String: Any],
let data = picture["data"] as? [String: Any],
let pictureURL = data["url"] as? String else {
return
}
log.debug(pictureURL)
})
But none of these solutions will update the profile picture URL when using Auth.auth().photoURL again. Any ideas on how I can update the photoURL and get the new photoURL when using Auth.auth().photoURL?