Auth0 Home Blog Docs

Auth0.swift, facebook login, 'Sorry, something went wrong'

login
facebook
swift

#1

Attempting to Facebook login via the webAuth(), just making sure this is a current facebook issue (seems unlikely?) Auth0.webAuth().connection(“facebook”).connectionScope(AuthorizationCoordinator.auth0DBConnection).start { (result) in Logger.log(result, .warning) } ![alt text][1] [1]: /storage/temp/813-screen-shot-2018-01-25-at-120406.png Thanks.


#2

Seems the issue was for some reason, adding a connectionScope would cause the facebook error


#3

The connectionScope allows you to set provider scopes for oauth2/social connections with a comma separated list. In the [Auth0.swift repository] (https://github.com/auth0/Auth0.swift/blob/931883ba3ac3a48d49152cd83a31badad957e3a5/Auth0/WebAuth.swift#L120-L127) it states: connectionScope: oauth2/social comma separated scope list: 'user_friends,email'

Just as an example, you can see more info about the facebook permissions scopes here: https://developers.facebook.com/docs/facebook-login/permissions/

So this code should work with the latest Auth0.swift library:

Auth0.webAuth().connection("facebook")
    .connectionScope("public_profile,email")
    .start { (result) in
        switch(result) {
        case .success(let credentials):
            (...)
         case .failure(let error):
             (...)
          }
    }