How to skip aut0 login page and directly redirect in to social login site?

In this case, you pass it as an option in loginWithRedirect as per

await auth0.loginWithRedirect({connection: '[Connection name]'});

Thanks math .i got it .but

  1. when i pass " display:“popup”…it is not coming in popup.

  2. in my project i want two connections i.e gmail, facebook.

my situation is when user click on “Login with gmail” i want to redirect to gmail page, when user click on “Login with fb” i want to redirect fb page.

  1. If you want to use a popup, you should use a different method, loginWithPopup instead of loginWithRedirect

  2. Do you mean, you want to offer both to a user at the same time? Then there’s no way to skip the Auth0 login page, otherwise how would the user be able to choose a connection between the two?

i will give two buttons in my view like “login with google” or “login with fb”.when user click on “goole” btn i will directly navigate to gmail page and vice-versa with fb also

Ok, so if you want to provide this view with the two buttons instead of Auth0 doing it with its login page, then you would trigger the auth0.loginWithRedirect request when the user clicks one of the two buttons and put the connection parameter, as shown above, dynamically based on which button the user clicked.

Relevant API docs for passing the connection parameter with the auth0-spa-js:

ok. i successfully implemented what u explain

after login i got "profile"object and it looks like below

1. email: " "
2. email_verified: true
3. family_name: " "
4. given_name: " "
5. locale: "NA"
6. name: "vishwanath paruvelly"
7. nickname: "vishwanath.p"
8. picture: " "
9. sub: " "
10. updated_at: " "

in that i can’t find JWT token…how to get jwt token after login with auth0

If you’re using the auth0-spa-js, you don’t get the raw ID token in JWT (this just applies to the new auth0-spa-js SDK, not the older auth0.js), because the SDK always validates, decodes and extracts the payload for you, so you don’t have to worry about it. This was a design decision by the SDK development team, because usually the raw JWT is hardly needed, since the client is mostly directly interested in the token payload itself.
Or do you need the ID token as JWT for specific purposes?

You just get the access token in raw JWT format, but not the ID token, because the ID token is usually meant to be used on the client, therefore usually no need for the raw JWT, while the access token is meant to be passed on to the backend/API that you’d want to protect with it.

i need jwt token for my back-end api integration .so how to get jwt token .for jwt token which sdk should i user

Can you provide the details what you’re doing with the ID token in the backend exactly? Is it used for authorization? Or to get user information in the backend?
Just to confirm: are you passing both the ID and access token to the backend?

(The auth0.js SDK provides a way to get the raw ID token as opposed to the auth0-spa-js at the moment, but this might change if there are enough valid use cases that show that providing the raw ID token might make sense, then the SDK might be changed in this regards. Therefore, you’re input on the details of the use case is valuable for us.)

jwt is used for authorization and authentication .and my total back-end is depends on jwt and back-end is already developed .

Yes, understand that you’re working with JWTs. Note that both ID token and access token are JWTs.

The question is: why do you need the ID token in the backend and not just use the access token?
Am I right to assume that you want to extract the user profile info like name, email address, etc. on the backend from the ID token? (So that you don’t need to make another request to fetch user profile info on the backend again).

An ID token is for authentication, usually meant to be used on the client side, while an access token is for authorization and meant to be used by the backend (and not the client), while it also contains a sub claim which refers to the subject (=user) on which behalf the backend/API is being called. So, from the access token alone, you would also know which user it’s referring to (by the user_id).

but in profile object i am not getting any unique identifier.

  1. is “sub” key which is present in profile obj is unique?

  2. plz tell me instead of jwt what i have to send to my back-end( i don’t have any idea what’s going in my back-end)

sub is a required field and it’s the unique identifier of the user. If you look at the Auth0 Dashboard > Users and into a user profile in detail, this sub claim in the ID and access token equals the user_id field of the user profile in the Auth0 Dashboard.

Where did you get that profile object from that you posted earlier? It doesn’t look complete, and also doesn’t seem to be something you retrieved from Auth0, because there wouldn’t be these empty values in it.

when i call to “this.auth0Client.getUser()” i got below obj

1. email: ""
2. email_verified: true
3. family_name: "Logistics"
4. given_name: "XprsLoop"
5. locale: "en"
6. name: "XprsLoop Logistics"
7. nickname: "xprsloop"
8. picture: "XXXXXXX"
9. sub: "XXXXXXX"
10. updated_at: "XXXXXXX"

so in this case shell i use “sub” key instead of jwt.

to reconform if i use auth0-spa-js i won’t get jwt .plz help me on this

So, the sub in the ID token is the unique user id. It’s also in the access token though.

to reconform if i use auth0-spa-js i won’t get jwt .

Yes, with the auth0-spa-js you get the Access Token as JWT, but not the ID Token as JWT (but only its payload).

so in this case shell i use “sub” key instead of jwt.

Unfortunately I still haven’t understood what (use case) you need the ID Token for on the backend site. Therefore I don’t know why you would need the JWT ID Token in the backend in the first place.
The sub is both in the ID Token and Access Token, so you should be good to just get the sub from the access token (not ID token) on the backend side, if all you need to do is to make the reference to the user.

so,how can i get “Access Token” with above sdk.

There is a good Angular Quickstart demonstrating this (fetching the token, making a backend/API call):

    const client = await this.authService.getAuth0Client();
    const token = await client.getTokenSilently();

    return this.httpClient
      .get('/api/external', {
        headers: {
          Authorization: `Bearer ${token}`

in “createAuth0Client” what is the use of “scope” param in createAuth0Client options

  1. in above thread u said “const token = await client.getTokenSilently();”
    what will return “getTokenSilently()”

actuvally i am getting something like"21h3SAHv0oLqTevhxPAL91muyfj9SE" .

what will return “getTokenSilently()”

You can check the API docs here:

If there’s a valid token stored, return it. Otherwise, opens an iframe with the /authorize URL using the parameters provided as arguments. Random and secure state and nonce parameters will be auto-generated. If the response is successful, results will be valid according to their expiration times.

actuvally i am getting something like"21h3SAHv0oLqTevhxPAL91muyfj9SE" .

This looks like an access token in opaque string format, not JWT. This is because you didn’t define the audience (that should be the API identifier of your API registered in Auth0 under Dashboard > APIs) in the request. See

Something like:

const token = await client.getTokenSilently({audience: 'https://example-api/}); . // replace with your own proper API identifier

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