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

hi ,
is it possible to skip authO login page and directly navigate to gmail or facebook page? if yes plz tell me.

the current process is

myApp=>authO Login page=>social web site login page=> Back to my App (if successful login page)

i want to skip authO login page .

Hey there!

It’s doable, you need to pass the connection parameter in the /authorize URL

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
1 Like

i am using angular 6 platform…

if u don’t mind can u explain where i have to edit…

In the request you’re sending from your client application. Which Auth0 SDK are you using?
Is it auth-js or auth0-spa-sdk ?

Or could you just show how you do the login / authorize request in your code in the client application right now? Then we can advise.

i downloaded your git repo and started working …
in my package.json i got “”@auth0/auth0-spa-js": “^1.0.0”,"

my angular Version is 8.0.3

In this case, you pass it as an option in loginWithRedirect as per https://auth0.github.io/auth0-spa-js/interfaces/redirectloginoptions.html#connection

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 https://auth0.github.io/auth0-spa-js/classes/auth0client.html#loginwithpopup

  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:
https://auth0.github.io/auth0-spa-js/interfaces/popuploginoptions.html#connection

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

ZoneAwarePromise{
__zone_symbol__value{
1. email: "xprsloop@gmail.com"
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.