# Auth0 "Password Rotation" Action incorrect redirect with expired password

**URL:** <https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022>\
**Category:** Get Help\
**Tags:** community-integration, marketplace\
**Created:** [August 30, 2023, 12:45pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022 "2023-08-30T12:45:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![adam20](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam20/32/33407_2.png) [@adam20](https://community.auth0.com/u/adam20)\
**Post date:** [August 30, 2023, 12:45pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/1 "2023-08-30T12:45:13Z")

</div>

I have a username/password database being used for authentication in a React web application. I want to require an end user to cycle their password if it is over 90 days old.

I implemented the **Password Rotation** Action documented here [Force a password reset after X days](https://community.auth0.com/t/force-a-password-reset-after-x-days/103037)

However the hosted UI at _https://{my-tenant}.us.auth0.com_ via the Universal Login (we aren’t using the classic custom UI feature) does not handle the case where a user needs to reset their password.

My expectations were that the **Password Rotation** action would redirect to the hosted UI which would have a state displaying to the user to reset their password.

What happens is that after entering in my username and password it redirects to

_https://{my-tenant}.us.auth0.com/authorize/resume?state={state variable}_

which then redirects to

https://{my-server-domain}/?error=access\_denied&error\_description=Your%20password%20has%20expired.%20%20Please%20reset%20it.&state={state variable}

So you can see it redirects out of a flow that touches the hosted UI and tries to have my web server handle the password reset which seems incorrect.

I’m trying to find the source code for this action to see what is the intended flow.

Does anyone have experience with this Action?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [August 30, 2023, 3:31pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/3 "2023-08-30T15:31:19Z")

</div>

Hi @adam20,

Welcome to the Auth0 Community!

I have just checked all of your tenants under your subscription account and found that none of them have the **Force a password reset after X days** Action deployed and bound to the Post-Login Action flow.

Could you please make sure that you have clicked on the “Add to flow” option? You can do this by going to the [Auth0 Dashboard \> Actions \> Library](https://manage.auth0.com/#/actions/library) and clicking on the triple-dot icon and selecting “Add to flow”:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/1/c1913fbfec74d895bce3c0642d793940362cadef.png)

Please make sure to click on “Apply” to save your changes once you have added it to the Post Login flow.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![adam20](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam20/32/33407_2.png) [@adam20](https://community.auth0.com/u/adam20)\
**Post date:** [August 30, 2023, 6:19pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/4 "2023-08-30T18:19:47Z")

</div>

Hi @rueben.tiow,

I did have `Password Retention` as part of our flow, but because we use the tenant for our test servers I had to take it out as it prevented any user with an expired password from authenticating and would get caught in that loop described above.

My description of the issue above is with `Password Retention` applied as part of our flow while I was testing it, then I took it out after I was finished.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [August 31, 2023, 8:38pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/5 "2023-08-31T20:38:41Z")

</div>

Hi @adam20,

Thanks for following up.

I have just checked your Password Rotation script’s configuration and see that you have the **Password Expiry in Days** set to 1 and not 90, which is your preferred number of days.

Let me also emphasize that this Action will only apply to users who authenticate with a Database Connection:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/d/4/d412e5e32698e116a7786d4431c5d3050d1f81a1.png)

Reference: [https://marketplace.auth0.com/integrations/auth-0-password-rotation](https://marketplace.auth0.com/integrations/auth-0-password-rotation)

Therefore, if you are using a different type of connection to authenticate, this Action will not force the user to reset their password.

---

<div class="post-metadata">

**Author:** ![adam20](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam20/32/33407_2.png) [@adam20](https://community.auth0.com/u/adam20)\
**Post date:** [September 12, 2023, 11:22pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/6 "2023-09-12T23:22:01Z")

</div>

Thanks Ruben, again the current settings were just those I was playing around with. Our same situation described above happens regardless of the period of time in days it is set to.

I experimented setting the Expiry in Days to 1 day to force the flow of needing to reset the password. Which again did not work as I kept getting redirected as described above.

From what I can tell the flow is broken or something about how we are using Auth0 in react maybe?

It would be helpful if I could view the source code for the **Password Rotation** login action. Could you point me to that?

---

<div class="post-metadata">

**Author:** ![udib](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/udib/32/34405_2.png) [@udib](https://community.auth0.com/u/udib)\
**Post date:** [September 20, 2023, 3:05pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/7 "2023-09-20T15:05:23Z")

</div>

Hi All,

I’m encountering the exact same issue.  
Properly configured the Password Rotation integration and as soon as i did, it is stuck in an endless loop with the invalid redirect URL.

Appreciate your assistance here.

Thanks,  
Udi

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [September 20, 2023, 3:35pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/8 "2023-09-20T15:35:04Z")

</div>

Hi @adam20,

Thanks for following up.

I have just tested the login flow with the Password Rotation built-in Action and can confirm that everything is working as expected.

Whenever a user tries to log in with an expired password, they get redirected to a URL like the following: `https://{yourDomain}/?error=access_denied&error_description=Your%20password%20has%20expired.%20%20Please%20reset%20it.&state={state variable}`

Here is a screenshot of a network trace: ![image](https://global.discourse-cdn.com/auth0/original/3X/a/e/aef451d947d164092781d6688204dc0482782ff2.png)

This is by design, and this requires the user to restart the login flow again to get to the login page and then follow up with the “Forgot Password?” option.

I hope the explanation was clear.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [September 20, 2023, 3:40pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/9 "2023-09-20T15:40:29Z")

</div>

Hi @udib,

If you are experiencing an endless loop, this happens because the user still has an active session.

In this case, you should consider passing the `prompt=login` query parameter to force the user to re-authenticate on the Universal Login page.

For example:

```auto
https://{yourDomain}/authorize?
    response_type=code&
    client_id={yourClientId}&
    redirect_uri={https://yourApp/callback}&
    scope={scope}&
    audience={apiAudience}&
    state={state}&
    prompt=login

```

(Reference: [New Universal Login Experience](https://auth0.com/docs/authenticate/login/auth0-universal-login/new-experience#signup:~:text=the%20callback%20url-,prompt%3Dlogin,-Shows%20the%20login))

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![udib](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/udib/32/34405_2.png) [@udib](https://community.auth0.com/u/udib)\
**Post date:** [September 20, 2023, 5:43pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/10 "2023-09-20T17:43:21Z")

</div>

Hi @rueben.tiow ,  
Thank you for your prompt response!  
I’m assuming you mean the ‘Customize Login Page’ section, please correct me if i’m wrong.  
This option is disabled on our tenants, is there any other way to force users to re-authenticate?

Thanks,  
Udi

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [September 21, 2023, 12:52am UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/11 "2023-09-21T00:52:15Z")

</div>

Hi @udib,

Thanks for the reply.

I do not mean the ‘Customize Login Page’ section. I mean passing the `prompt=login` in your login request.

You will need to adjust your authorization parameters for your login call to include 'prompt=login`. This will depend on the SDK you are using. Note that this will always force your users to re-authenticate.

One other possibility would be to have a mechanism to have these users log out so that they can re-authenticate. Or having the session be as short-lived as possible.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![adam20](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam20/32/33407_2.png) [@adam20](https://community.auth0.com/u/adam20)\
**Post date:** [September 26, 2023, 2:05pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/12 "2023-09-26T14:05:54Z")

</div>

For my issue I am using the React SDK with the `Auth0Provider` component. It does not have a configuration for the `prompt` directly. The only mention of it I see is here [https://github.com/auth0/auth0-spa-js/blob/f9d33040b432cdb2990f46085c9286c25497fe31/src/global.ts#L156](https://github.com/auth0/auth0-spa-js/blob/f9d33040b432cdb2990f46085c9286c25497fe31/src/global.ts#L156) .

I am using username/password via a database for logging in and not an IDP. I set the timeouts for my tokens to be very short and removed them from the browser cache then waited longer than needed for everything to expire and the endless loop still occurs.

So I don’t think that setting the prompt would resolve the issue as I can guarantee there are no valid refresh or access tokens for the test user I am experiencing this with.

Regarding the proper use of this action is it documented anywhere? This confuses me.

> [@rueben.tiow](#):
>
> I have just tested the login flow with the Password Rotation built-in Action and can confirm that everything is working as expected.
> 
> Whenever a user tries to log in with an expired password, they get redirected to a URL like the following: `https://{yourDomain}/?error=access_denied&error_description=Your%20password%20has%20expired.%20%20Please%20reset%20it.&state={state variable}`

`yourDomain` - does this refer to the domain I actually own or my `Auth0 domain`.

For example if I own the domain [www.MyWebsite.com](http://www.MyWebsite.com) and I lets say an `auth0` domain of `mywebsite-auth0.com` where my Auth0 Universal login UI is hosted.

Shouldn’t the `Password Rotation` action redirect the end user to the Hosted UI at my `Auth0` domain `mywebsite-auth0.com`?

Right now it is redirecting them to my application’s domain aka `www.MyWebsite.com?error=access_denied&error_description=Your%20password%20has%20expired.%20%20Please%20reset%20it.&state={state variable}`

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [September 27, 2023, 4:53pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/13 "2023-09-27T16:53:50Z")

</div>

Hi @adam20,

Thanks for following up.

When using the React SDK, you can specify the `prompt=login` as an `authorizationParams` in the loginWithRedirect() method. In this situation, you will want to handle the login error by redirecting the user back to the login page if the “access\_denied” error occurs.

For example:

```auto
const options = {
  prompt: 'login'
}
await loginWithRedirect(options);

```

(Reference: [AuthorizationParams | @auth0/auth0-react](https://auth0.github.io/auth0-react/interfaces/AuthorizationParams.html))

Please let me know if you have any questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![adam20](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam20/32/33407_2.png) [@adam20](https://community.auth0.com/u/adam20)\
**Post date:** [October 2, 2023, 11:14am UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/14 "2023-10-02T11:14:29Z")

</div>

Oh I see, am I correct in assuming the Auth0 action **Password Rotation** ’s purpose is to return an access\_denied error with a message string and you have to manually handle it on the front end.

I was under the assumption that the redirect from **Password Rotation** would be handled by the **Auth0Provider** React component to open the **Universal Login** taking the user to the **Password Reset** screen (shown below) with the `error_description` param describing why the error was thrown being shown to the user in the universal login screen.

I added `prompt: 'login'` to `loginWithRedirect`, it does fix the endless loop by bringing the user back to the _login_ screen. But it does not take them to the “Reset your password” screen. There is no notice to the user that the reason they authenticated successfully but are still at the login screen is due to an old password.

If the above assumptions are true is it possible to somehow bring the user to the **Password Reset** view in the **Universal Login** with a message?

 ![Screenshot 2023-10-02 at 1.59.34 PM](https://global.discourse-cdn.com/auth0/original/3X/a/5/a566798ec03e6c83544d543cb67e28a10cd89b3b.png)

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 2, 2023, 4:20pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/15 "2023-10-02T16:20:24Z")

</div>

Hi @adam20,

That is the expected behavior. The Password Rotation does not redirect the user to the Password Reset screen. Instead, the user must click on the “Forgot Password” option when they are redirected back to the login page to initiate the password reset flow.

I hope that is clear!

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![adam20](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam20/32/33407_2.png) [@adam20](https://community.auth0.com/u/adam20)\
**Post date:** [October 2, 2023, 6:06pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/16 "2023-10-02T18:06:22Z")

</div>

Ah I see, so this was working as intended I was just not aligned on what the designed flow was.

Is there a way to redirect a user to the **Reset Password** screen in the Universal Login hosted UI with a custom message? Or would that have to be handled in our web application?

Right now the user doesn’t know to reset their password because nothing is indicating the error.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/8/c8d7f403fd138caa4c61dae247e636bae8d2f2c6.png)

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 2, 2023, 6:42pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/17 "2023-10-02T18:42:46Z")

</div>

Hi @adam20,

> [@adam20](#):
>
> Is there a way to redirect a user to the **Reset Password** screen in the Universal Login hosted UI with a custom message? Or would that have to be handled in our web application?

Unfortunately, there is no way to redirect the user to the Password Reset screen. The response below in a related community topic answers this question:

> [@How to call the password reset page](https://community.auth0.com/t/how-to-call-the-password-reset-page/96130/4):
>
> Hi @david.martinez2 , Currently, you can’t redirect the users to the reset password page because this is something that comes out from the link sent to the users through the email template for that purpose. Nevertheless, you can create your own reset page and manage the password resets with the management API. There are two basic methods for changing a user’s password: Trigger an interactive password reset flow that sends the user a link through email. The link opens the Auth0 password reset …

> [@adam20](#):
>
> Right now the user doesn’t know to reset their password because nothing is indicating the error.

The error is shown when they try to log in, and they are instructed to reset their password before continuing. The password reset page will not show the error, because it only allows them to set a new password. There are no checks happening during this stage.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![adam20](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam20/32/33407_2.png) [@adam20](https://community.auth0.com/u/adam20)\
**Post date:** [October 3, 2023, 7:47pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/18 "2023-10-03T19:47:23Z")

</div>

> [@rueben.tiow](#):
>
> The error is shown when they try to log in,

Can you please clarify what you mean by this? (A screenshot would be helpful)

I do not see in the Hosted UI any error shown to the end user that the login failed due to an expired password.

The redirect url does contain the text, but this URL does not actually get handled by the react `<Auth0Provider>` component and only shows a white screen before my application calls `loginWithRedirect` and brings them back to the starting login screen (with no error message)

example URL: _https://{my-server-domain}/?error=access\_denied&error\_description=Your%20password%20has%20expired.%20%20Please%20reset%20it.&state={state variable}_

---

<div class="post-metadata">

**Author:** ![adam20](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam20/32/33407_2.png) [@adam20](https://community.auth0.com/u/adam20)\
**Post date:** [October 12, 2023, 7:08am UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/19 "2023-10-12T07:08:57Z")

</div>

Hi I was wondering if you could provide some final clarification to the question above?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 20, 2023, 8:16pm UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/20 "2023-10-20T20:16:46Z")

</div>

Hi @adam20,

Thanks for the replies.

> [@adam20](#):
>
> Can you please clarify what you mean by this? (A screenshot would be helpful)

When the user tries to log in, they will see this error in the URL: _https://{my-server-domain}/?error=access\_denied&error\_description=Your%20password%20has%20expired.%20%20Please%20reset%20it.&state={state variable}_

The user will continue to see the error in the URL until they have reset their password.

---

<div class="post-metadata">

**Author:** ![adam20](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam20/32/33407_2.png) [@adam20](https://community.auth0.com/u/adam20)\
**Post date:** [October 22, 2023, 11:41am UTC](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022/21 "2023-10-22T11:41:50Z")

</div>

And that is the intended user experience? That a non-technical end user would need to know to visually parse the URL in a query string for an error message?

My assumption is then that the `Password Rotation` action is **not** intended for web applications, especially those that utilize the Universal Hosted UI by Auth0?

[Next page](https://community.auth0.com/t/auth0-password-rotation-action-incorrect-redirect-with-expired-password/115022.md?page=2)
