Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let credential = FacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)
- Auth.auth().signIn(with: credential, completion: {
- user, error in
- if error == nil {
- // Sign up successful
- // Save user's selected avatar image to our Firebase storage
- let firebaseStorage = Storage.storage().reference()
- let avatarImageReference = firebaseStorage.child((user?.uid)! + ".jpg")
- // Download profile picture from Facebook URL
- ImageDownloader.default.downloadImage(with: URL(string: profilePictureUrl.stringValue)!, options: [], progressBlock: nil, completionHandler: {
- image, error, url, data in
- let _ = avatarImageReference.putData(data!, metadata: nil) {
- metadata, error in
- if error == nil {
- // Success
- }
- }
- })
- }
- })
Add Comment
Please, Sign In to add comment