|
| 1 | +--- |
| 2 | +id: redirect-post-account-operations |
| 3 | +title: Redirect to Application Post Account Operations (Unlock, Activation, Forgot Password) |
| 4 | +sidebar_label: Redirect Post Account Operations |
| 5 | +slug: /redirect-post-account-operations |
| 6 | +description: Ensure a user is redirected back to an application after a user has successfully performed an account operation such as unlock, activation, or password reset. |
| 7 | +keywords: |
| 8 | +- Okta CIAM |
| 9 | +- Redirect After Forgot Password |
| 10 | +- Redirect After Account Unlock |
| 11 | +- Okta Email Templates |
| 12 | +- Email Templates for Multiple Applications |
| 13 | +--- |
| 14 | + |
| 15 | +## Problem |
| 16 | +By default, Okta will redirect the user to the Okta dashboard upon unlocking their account or resetting their password. |
| 17 | + |
| 18 | +This is an undesirable experience for CIAM applications as users are expect to be redirected to the application. |
| 19 | + |
| 20 | +## Solution |
| 21 | +Okta supports a query string called `fromURI` to determine where to redirect the user. Simply append the URI in an url safe encoding to the account operation links. Feel free to use this [URL encoding tool](https://meyerweb.com/eric/tools/dencoder/) to encode the URI before appending it. |
| 22 | + |
| 23 | +In addition to appending the query string, you'll need to add this URI as a trusted origin within the admin dashboard (Security > API > Trusted Origin > Add Origin). |
| 24 | + |
| 25 | +Below are some examples based on our default templates using a encoded URI of "https://YOUR_APP_URI_HERE.com" as `https%3A%2F%2FYOUR_APP_URI_HERE.com` |
| 26 | + |
| 27 | +**Example: Forgot Password** |
| 28 | +```html |
| 29 | +<td align="center"> |
| 30 | + <a id="reset-password-link" href="${resetPasswordLink}?fromURI=https%3A%2F%2FYOUR_APP_URI_HERE.com" |
| 31 | + style="text-decoration:none"> |
| 32 | + <span |
| 33 | + style="padding:9px 32px 7px 31px;border:1px solid;text-align:center;cursor:pointer;color:#fff;border-radius:3px;background-color:#44bc98;border-color:#328c71 #328c71 #2f856b;box-shadow:0 1px 0 #d8d8d8"> |
| 34 | + Reset Password |
| 35 | + </span> |
| 36 | + </a> |
| 37 | +</td> |
| 38 | +``` |
| 39 | + |
| 40 | +**Example: User Activation** |
| 41 | +```html |
| 42 | +<td align="center" style="display:inline-block;padding:10px;border:1px solid;text-align:center;cursor:pointer;color:#fff;border-radius:3px;background-color:#44bc98;border-color:#328c71 #328c71 #2f856b;box-shadow:#d8d8d8 0 1px 0"> |
| 43 | + <a id="reset-password-link" href="${activationLink}?fromURI=https%3A%2F%2FYOUR_APP_URI_HERE.com" style="text-decoration:none"> |
| 44 | + <span style="font-size:13.5px;color:#fff"> |
| 45 | + Activate Okta Account |
| 46 | + </span> |
| 47 | + </a> |
| 48 | +</td> |
| 49 | +``` |
| 50 | + |
| 51 | +**Example: Unlock Account** |
| 52 | +```html |
| 53 | +<td align="center" style="height:32px;padding-top:24px;padding-bottom:8px"> |
| 54 | + <a id="unlock-account-link" href="${unlockAccountLink}?fromURI=https%3A%2F%2FYOUR_APP_URI_HERE.com" style="text-decoration:none"> |
| 55 | + <span style="padding:9px 32px 7px 31px;border:1px solid;text-align:center;cursor:pointer;color:#fff;border-radius:3px;background-color:#44bc98;border-color:#328c71 #328c71 #2f856b;box-shadow:0 1px 0 #d8d8d8"> |
| 56 | + Unlock Account |
| 57 | + </span> |
| 58 | + </a> |
| 59 | +</td> |
| 60 | +``` |
| 61 | + |
| 62 | +## Discussion |
| 63 | +If your tenant requires more than one email template due to multiple applications, Okta does not support this out of the box. However, you can leverage the user's locale property to serve different emails per application. More information can be found [here](https://support.okta.com/help/s/article/How-to-leverage-different-activation-email-templates-based-on-a-user-profile-attribute-value?language=en_US). |
0 commit comments