44 thoughts on “Swift 3: Firebase Social Login – Facebook Email and Custom Login Button (Ep 2) | Web chia sẻ những tiện ích có ích nhất

  1. Daniel Gannage says:

    Thank you for the videos!

    When I use swift 4 I get an error on the line: loginButton.delegate = self 

    It says: Cannot assign value of type 'ViewControllerB' to type 'FBSDKLoginButtonDelegate!'

    It wants to fix with: loginButton.delegate = self as! FBSDKLoginButtonDelegate

    However, I get a "Thread 1: signal SIGABRT" crash. Any idea how to get around this?

  2. Manik Chaudhery says:

    Hi, how do I connect the facebook login button to proceed to the next view controller after authentication?

  3. Jennifer Sipila says:

    Once I successfully get the result from the Graph Request, how do I get the separate elements(name, email, etc.) from result? It is of type Any? and doesn't seem to conform to Dictionary or Array types so I'm not able to access the elements through subscripting or through the keys.

  4. GulamALI says:

    great video Brian.. please make a video on how to create a custom share button using fb sdk..in swift4

  5. Sanket Ray says:

    what else can we specify in loginButton.readPermissions?Is there a way to get the image, DOB etc? I really want to get the image of the user or else the image url. I am not even getting the email id of the user even after specifying in the permissions. The only thing i get as result is "id" and "name" :'(

  6. Al Mobin says:

    Your explanation is out of the world!! Thanks man…I was struggling for 2 days with this stupid things…<3

  7. Shaman Ito says:

    One more comment Brian, you don't need to switch the app to production mode to be able to log in with different users. You can just add them as testers on the facebook developer console project under the "Roles" section and it will work like a charm

  8. Nida Pervez says:

    Hi Brian, I still don't quite understand the difference between the two facebook buttons. From my understanding, the former is the generic log in, and the latter has customization capabilities e.g. color, font, etc., but do both buttons have the same functionality in terms with their relationship with Firebase? Meaning if i just keep the first button, will my users still be updated to firebase?

  9. Mark Underwood says:

    Brian, I added the "print" statements in the FBSDKGraphRequest function, but both came up with a warning "Expression implicitly coerced from…" – and neither printed anything to the console. Xcode 8.3.3, FBSDK iOS 4, iOS 10.3.3 on iPad Pro.

  10. Quinton Askew says:

    Is there a way I can use the functionality of the Original Facebook button with a custom button? I want to keep the behavior, but I want to design my own button.

  11. Dew Time says:

    Ok so everything works when I am logged into (any) account on facebook on safari. However if I log out of safari, and try to login on the app, it brings me to the facebook app and then when i go back to the app I get an error saying I couldn't log in.

  12. Franklin Heng says:

    For those having trouble displaying the email address, add in the viewDidLoad() function:

    loginButton.readPermissions = ["email"]

  13. Jorge Cardona says:

    Hi Brian, how do you redirect users who have signed up through FB to your main feed?

  14. clappybear says:

    was getting a Build Failed at:
    customFBButton.addTarget(self, action: #selector(handleCustomFBLogin), for: touchUpInside)

    took a while to figure out why, not sure how/why it works in the video and not for me but it was solved with:
    customFBButton.addTarget(self, action: #selector(handleCustomFBLogin), for: UIControlEvents.touchUpInside)

    needed to add the "UIControlEvent. " to the end of addTarget

  15. swapnesh porwal says:

    Hi Brian, there is an issue :-> " Falling back to storing access token in NSUserDefaults because of simulator bug" . so what can i do for it.?

  16. Bryant Obeng says:

    Hi Brian, how do you redirect users who have signed up through FB to your main feed?

  17. Raul J. C. says:

    Hello Brian, I would like to know how do you catch the email in a string only the email

  18. Deyan Dobrev says:

    Hi, Brian and thanks for the great tutorial! Is it possible to get user's Firebase ID after authenticating with Facebook? In my case Im using user's Firebase ID as a reference for writing user's data into Firebase. Thanks in advance! 🙂

  19. Алексей Савченко says:

    Thanks for the tutorial! One question is still there, how to extract info from a 'result' object from GraphRequest.start{} callback? Result object has type of GraphRequestResult<GraphRequest>. How do I extract email and other fields from it? Any help appreciated.

  20. Limyandi Vico Trico says:

    Hi Brian, in the custom facebook button, you showed us how to handle the custom login, but how to handle the logout?

  21. Michael Stram says:

    The only thing not showing for me is the email, but everything else is working! Great tutorial!

  22. SubzeroWins says:

    Hi Brian, I have a question: How can I fetch users from Email Auth and FB Auth if the FBauth doesn't creates a user in the database under the 'users' node? Thanks

  23. TKollaKid says:

    My FBSDkProfile.current() returns nil when I am using a custom button. Not sure why. Has that ever happened to you before? Not sure why it's nil if I am logged in.

  24. Antonio Di Francesco says:

    Hi Brian(o) 🙂

    Your videos are great, thanks a lot from a fan from Italy!

    I was wondering how to enable the custom FB login button to take care of Log Out as well, switching the Title of the button accordingly. This is how I proceeded, it seems to work, but would be great to have your opinion about it.

    I modified the showEmailAddress() like this

    func showEmailAddress(){

    FBSDKGraphRequest(graphPath: "/me", parameters: ["fields":"id,name,email"]).start { (connection, result, err) in

    if err != nil {
    print("Failed to start graph request:", err!)
    } else {
    // This is the last step of the login process. If everything has gone fine, we can switch the button Title to LogOut.
    self.customFBButton.removeTarget(self, action: #selector(self.handleCustomFBLogin), for: .touchUpInside)
    self.customFBButton.addTarget(self, action: #selector(self.handleCustomFBLogout), for: .touchUpInside)
    self.customFBButton.setTitle("Log out", for: .normal)



    And then added the handleCustomFBLogout function

    func handleCustomFBLogout() {
    self.customFBButton.setTitle("Custom FB Login here", for: .normal)
    print("Did log out with custom button")
    self.customFBButton.removeTarget(self, action: #selector(self.handleCustomFBLogout), for: .touchUpInside)
    self.customFBButton.addTarget(self, action: #selector(self.handleCustomFBLogin), for: .touchUpInside)


    Is this add and remove target a good way to proceed?

    Thanks again for your amazing videos!

  25. TKollaKid says:

    Your videos are friggin' awesome. So easy to follow. It would of taken me forever to figure all this out on my own. Thanks a lot.

  26. Ning Hong says:

    Hi Brian! Thank you for this great video! I learned a lot 🙂 I have a question, how can I display user's profile picture upon their log in? You know how right now it's just a gray symbol? I want that to be the profile picture. I know you did that for another video but I don't think you specified how you did it.

    what I did so far is I added : "picture.type(large) " as a parameter and then FBSDKProfilePictureView().profileID = the picture url. but it's not working. This is probably pretty stupid but I am so new to this, sorry!

  27. Jesus Rodriguez says:

    the print statements within the two facebook methods are not working for me. I completed the first tutorial no problem. This is odd

  28. Maiko Hermans says:

    I'm not getting the email address unless I specify this.
    loginButton.readPermissions = ["email"];

    Did something change or did I just do it wrong…

  29. Ernie Miranda says:

    Awesome video. Very detailed and organized. Really enjoy your presentation style!
    What software do you use to record them?

  30. Amrutha Krishnan says:

    Hey Brian, thanks a lot for posting this video I think it was extremely helpful. However, having an issue retrieving my email information from the result. Is there anyway to get it?

Comments are closed.