# Custom Action to redirect, redirects to early

**URL:** <https://community.auth0.com/t/custom-action-to-redirect-redirects-to-early/105807>\
**Category:** Get Help\
**Tags:** extensibility, actions-extensibility\
**Created:** [April 29, 2023, 3:23pm UTC](https://community.auth0.com/t/custom-action-to-redirect-redirects-to-early/105807 "2023-04-29T15:23:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ralkey](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ralkey/32/46785_2.png) [@Ralkey](https://community.auth0.com/u/Ralkey)\
**Post date:** [April 29, 2023, 3:23pm UTC](https://community.auth0.com/t/custom-action-to-redirect-redirects-to-early/105807/1 "2023-04-29T15:23:24Z")

</div>

Hello

I am attempting to get the login page to redirect to `http://localhost:3000/admin` instead of `http://localhost:3000` after authentication is completed.

I read [this post](https://community.auth0.com/t/how-to-configure-auth0-application-to-redirect-to-a-specific-url-after-login/89544/2) which says you can do that with Actions

However, after implementing it, the flow will redirect the user back to the website before completing the authentication.

This is what I did:

1. create a custom action with the trigger “Login / Post login”
2. pasted in the code provided in the link above with my own URL
3. went to Flow \> Login, and put the custom action in the flow.

Could there be something I did wrong, Or is there a better method?

(also i have no clue how the tagging system works so sorry for weir tags)

---

<div class="post-metadata">

**Author:** ![SaqibHussain](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/saqibhussain/32/42924_2.png) [@SaqibHussain](https://community.auth0.com/u/SaqibHussain)\
**Post date:** [April 29, 2023, 9:40pm UTC](https://community.auth0.com/t/custom-action-to-redirect-redirects-to-early/105807/2 "2023-04-29T21:40:34Z")

</div>

Hi @Ralkey

Welcome to the Auth0 Community.

The redirect using Actions is more of a temporary redirect to perform some additional actions as part of the authentication flow and by design you’re expected to return to the Action to complete the authentication. It may not be a suitable fit for your use case. There would be a better way, I’m assuming by default after authentication you come back to `http://localhost:3000` as an authenticated user (providing the auth was successful).

If you want to redirect the user to a specific url post authentication and it’s static url i.e. it’s always going to be the same for every user you could just bake that into your application e.g. I have a dot net application which is a regular web app. My callback is `https://localhost:5001/callback` which is handled by the middleware and I return to `https://localhost:5001` by default post successful authentication.

I can redirect somewhere else within my app like this:

```auto
public async Task Login(string returnUrl = "/Account/UserProfile")
{
    await HttpContext.ChallengeAsync("Auth0", new AuthenticationProperties() { RedirectUri = returnUrl });
}

```

There may be something similar you can do via the SDK that you’re using.

If you need some flexibility you can take this approach and use the state parameter [https://community.auth0.com/t/dynamic-callback-after-login/8788](https://community.auth0.com/t/dynamic-callback-after-login/8788)

I hope this helps.  
Warm regards.

---

<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:** [May 13, 2023, 9:41pm UTC](https://community.auth0.com/t/custom-action-to-redirect-redirects-to-early/105807/3 "2023-05-13T21:41:30Z")

</div>

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