Auth0 Home Blog Docs

Is it possible to use social login with Authentication API?

login
social
social-connection

#1

I am working on custom login/sign-up UI and for this I am using Authentication API.
I was able to login and request profile , now the question is how to login using social networks. Is it possible to do it through Authentication API or I shall need to take some other ways?


#2

You can use the Authentication API /authorize endpoint. This will return a 302 redirect to the social provider specified in connection parameter.

As noted in the docs:

Social connections only support
browser-based (passive) authentication
because most social providers don’t
allow a username and password to be
entered into applications that they
don’t own. Therefore, the user will be
redirected to the provider’s sign in
page.


#3

@prashant, is there some example I could follow? Also, as I am creating a new custom login form, is Authentication API my only choice? What would be recommendation here?


#4

By custom login form, do you wish to capture the login details for the social connection in your form? If so, this is not possible due to the note outlined in the answer.

If you wish to have a custom login form with a button to trigger the social login, e.g. a “Login with Facebook” button, you can use the following to trigger a login with the Facebook connection:

webAuth.popup.authorize({
  connection: 'facebook'
});

This is outlined further in the Auth0.js doc:
https://auth0.com/docs/libraries/auth0js/v8#webauth-popup-authorize-


#5

Thanks, I shall follow the docs


#6