How can I skip universal login for django app

How can I skip universal login and go directly into the social login page? I am following Django quick start guide.
I have found this configuration in https://community.auth0.com/t/how-to-skip-aut0-login-page-and-directly-redirect-in-to-social-login-site/28211/3?u=karunamay post

https://[tenant].auth0.com/authorize?
audience=[API Identifier]
&scope=openid+profile+email
&response_type=token
&client_id=[Client ID]&connection=[Connection name]
&redirect_uri=[Redirect URI]
&nonce=123

But confused about where to edit this.
Here is the Django code

class Auth0(BaseOAuth2):
    """Auth0 OAuth authentication backend"""
    name = 'auth0'
    connection='twitter'
    SCOPE_SEPARATOR = ' '
    ACCESS_TOKEN_METHOD = 'POST'
    REDIRECT_STATE = False
    EXTRA_DATA = [
        ('picture', 'picture'),
        ('email', 'email')
    ]

    def authorization_url(self):
        return 'https://' + self.setting('DOMAIN') + '/authorize'
        # return f"https://{self.setting('DOMAIN')}/authorize?connection=twitter"

    def access_token_url(self):
        return 'https://' + self.setting('DOMAIN') + '/oauth/token'

    def get_user_id(self, details, response):
        """Return current user id."""
        return details['user_id']

    def get_user_details(self, response):
        # Obtain JWT and the keys to validate the signature
        id_token = response.get('id_token')
        jwks = request.urlopen(
            'https://' + self.setting('DOMAIN') + '/.well-known/jwks.json')
        issuer = 'https://' + self.setting('DOMAIN') + '/'
        audience = self.setting('KEY')  # CLIENT_ID
        payload = jwt.decode(id_token, jwks.read(), algorithms=[
                             'RS256'], audience=audience, issuer=issuer)
        return {'username': payload['nickname'],
                'first_name': payload['name'],
                'picture': payload['picture'],
                'user_id': payload['sub'],
                'email': payload['email']}

Hi @Karunamay,

Thanks for reaching out to the Auth0 Community!

I understand you would like to skip the Universal Login page and direct your users straight to the Social Login Page.

In this case, you will need to specify the connection parameter in your /authorize request.

For example:

https://YOUR_DOMAIN/authorize?
    response_type=code&
    client_id=YOUR_CLIENT_ID&
    redirect_uri=https://YOUR_APP/callback&
    scope=SCOPE&
    audience=API_AUDIENCE&
    state=STATE&
    connection=YOUR_SOCIAL_CONNECTION_NAME

Once this is complete, your users will be directed to the Social Login page to authenticate into your application.

Hoped this helps!

Please do not hesitate to reach out if you have additional questions.

Thank you.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.