# Login with connection query param redirects back to login without it

**URL:** <https://community.auth0.com/t/login-with-connection-query-param-redirects-back-to-login-without-it/184532>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [March 26, 2025, 2:00pm UTC](https://community.auth0.com/t/login-with-connection-query-param-redirects-back-to-login-without-it/184532 "2025-03-26T14:00:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![guymic](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/guymic/32/73463_2.png) [@guymic](https://community.auth0.com/u/guymic)\
**Post date:** [March 26, 2025, 2:00pm UTC](https://community.auth0.com/t/login-with-connection-query-param-redirects-back-to-login-without-it/184532/1 "2025-03-26T14:00:05Z")

</div>

Ready to post? 🔍 First, try searching for your answer.  
As part of a flow with custom postLogin action which performs account liking. i am sending the user back to my app, which sends with back to auth0 login page with connection={social\_login\_connection\_name}. Instead of acting as expected (continuing as if the user clicked the social login button, which would have logged him in directly), the http response is 302 which sends the browser to a auth0 authorize page, which then redirects again to a login page WITHOUT the connection paramater.  
If the user indeed presses the relevant social login button he is indeed logged in.

What is the issue with using login?connection=xxx?

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [March 26, 2025, 7:48pm UTC](https://community.auth0.com/t/login-with-connection-query-param-redirects-back-to-login-without-it/184532/3 "2025-03-26T19:48:31Z")

</div>

Hi @guymic,

Welcome to the Auth0 Community!

You need to use the `/authorize` endpoint adding the connection parameter there alongside all the other parameters needed.

For example:

`https://{yourDomain}/authorize?response_type=id_token&client_id={yourClientId}&redirect_uri={yourRedirectUri}&connection={yourConnection}&nonce={aRandomStringSequence}`

You can follow this doc section where you have an example of account linking using actions:

> **[Link User Accounts](https://auth0.com/docs/manage-users/user-accounts/user-account-linking/link-user-accounts#example-account-linking-with-actions)**
>
> Understand how to link user accounts from various identity providers, so your users can authenticate from any account and be recognized by your app.

If you have any other questions feel free to reach out.

Have a good one,  
Vlad

---

<div class="post-metadata">

**Author:** ![guymic](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/guymic/32/73463_2.png) [@guymic](https://community.auth0.com/u/guymic)\
**Post date:** [March 27, 2025, 9:44am UTC](https://community.auth0.com/t/login-with-connection-query-param-redirects-back-to-login-without-it/184532/4 "2025-03-27T09:44:08Z")

</div>

When doing this (redirecting to /authorize, and not back to my app to start challange to /login), i am indeed continuing to the stage when the users is prompted to allow access, but when in lands back in my [asp.net](http://asp.net) core app, i get the OpenIdConnect failure: OpenIdConnectAuthenticationHandler: message.State is null or empty.  
Perhaps this is because pointing to /authorize is part of the SPA flow, and not the regular web app flow?  
In any case, that doesnt work

---

<div class="post-metadata">

**Author:** ![guymic](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/guymic/32/73463_2.png) [@guymic](https://community.auth0.com/u/guymic)\
**Post date:** [March 27, 2025, 11:25am UTC](https://community.auth0.com/t/login-with-connection-query-param-redirects-back-to-login-without-it/184532/5 "2025-03-27T11:25:18Z")

</div>

I have also tried using redir to /authorize with response\_type=code, in which case i do get (after consent) a redir with a code and a state, but am getting error on my app’s side: Unable to unprotect the message.State.

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [March 27, 2025, 7:56pm UTC](https://community.auth0.com/t/login-with-connection-query-param-redirects-back-to-login-without-it/184532/6 "2025-03-27T19:56:53Z")

</div>

If you want to use the Post-Login trigger to redirect the user to login again it might put them into an infinite loop since it will get triggered again. I would advise you to redirect them from within your application instead of the action and maybe doing the account linking from there too.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [April 10, 2025, 7:57pm UTC](https://community.auth0.com/t/login-with-connection-query-param-redirects-back-to-login-without-it/184532/7 "2025-04-10T19:57:12Z")

</div>

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