# After a successful login the code parameter in the url keeps changing and my apps doesn't load

**URL:** <https://community.auth0.com/t/after-a-successful-login-the-code-parameter-in-the-url-keeps-changing-and-my-apps-doesnt-load/199451>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [April 29, 2026, 1:17pm UTC](https://community.auth0.com/t/after-a-successful-login-the-code-parameter-in-the-url-keeps-changing-and-my-apps-doesnt-load/199451 "2026-04-29T13:17:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![deym2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/deym2/32/70868_2.png) [@deym2](https://community.auth0.com/u/deym2)\
**Post date:** [April 29, 2026, 1:17pm UTC](https://community.auth0.com/t/after-a-successful-login-the-code-parameter-in-the-url-keeps-changing-and-my-apps-doesnt-load/199451/1 "2026-04-29T13:17:30Z")

</div>

I developed a shinyapp and I deployed using shinyapps\_io service. I deployed into my personal account and works fine but when I deploy it into a payed account after the login it redirects to a url like the one below, and the code and state parameters keep changing.

`resplab.shinyapps.io/forecasting-cf/?code=9213x09X_r280spupGjEC6ukhR6dl4EjQWZ72CFibnpOB&state=8RglRv9vqt\\\`

The content of my \_auth0 file is:

name: CF-Simulation-App  
remote\_url: ‘[https://resplab.shinyapps.io/forecasting-cf/’](https://resplab.shinyapps.io/forecasting-cf/%E2%80%99)  
auth0\_config:  
api\_url: !expr paste0(‘https://’, Sys.getenv(‘AUTH0\_USER’), ‘.auth0.com’)  
credentials:  
key: !expr Sys.getenv(“AUTH0\_KEY”)  
secret: !expr Sys.getenv(“AUTH0\_SECRET”)

---

<div class="post-metadata">

**Author:** ![deym2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/deym2/32/70868_2.png) [@deym2](https://community.auth0.com/u/deym2)\
**Post date:** [April 29, 2026, 1:21pm UTC](https://community.auth0.com/t/after-a-successful-login-the-code-parameter-in-the-url-keeps-changing-and-my-apps-doesnt-load/199451/2 "2026-04-29T13:21:33Z")

</div>

The callback url for my app in my auth0 console are:

**Allowed Callback URLs:**

**`[https://resplab.shinyapps.io/forecasting-cf/\*\*`](https://resplab.shinyapps.io/forecasting-cf/**%60)**

Allowed Logout URLs:\*\*

[https://resplab.shinyapps.io/forecasting-cf/](https://resplab.shinyapps.io/forecasting-cf/)

---

<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 29, 2026, 1:21pm UTC](https://community.auth0.com/t/after-a-successful-login-the-code-parameter-in-the-url-keeps-changing-and-my-apps-doesnt-load/199451/3 "2026-04-29T13:21:50Z")

</div>



---

<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 29, 2026, 3:05pm UTC](https://community.auth0.com/t/after-a-successful-login-the-code-parameter-in-the-url-keeps-changing-and-my-apps-doesnt-load/199451/4 "2026-04-29T15:05:14Z")

</div>



---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [April 29, 2026, 6:32pm UTC](https://community.auth0.com/t/after-a-successful-login-the-code-parameter-in-the-url-keeps-changing-and-my-apps-doesnt-load/199451/6 "2026-04-29T18:32:22Z")

</div>

Hi @deym2

Welcome to the Auth0 Community!

If you are experiencing an endless redirect loop (where the URL constantly flashes new `code` and `state` values) , it could be a symptom of a **Session State Failure** during the OAuth2 Authorization Code Flow.

When your paid ShinyApps environment receives the `code` and `state` from Auth0, it attempts to validate the `state` against what it originally stored in the user’s browser session. If it cannot find that original state (usually because the session cookie was dropped, blocked, or not securely scoped to the new paid domain), the `auth0` package assumes the login attempt is invalid or malicious. It immediately rejects the login and throws the user back to Auth0 to try again, causing the infinite loop.

The transition from a personal ShinyApps tier to a paid tier often involves changes in load balancing, cookie domains, or worker processes. Could you check the following things regarding your ShinyApp implementation?

- Double-check your Auth0 Dashboard → Applications → Settings. Ensure that your exact paid URL is listed in the **Allowed Callback URLs** :  
`https://resplab.shinyapps.io/forecasting-cf/` (Ensure the trailing slash is perfectly matched if your app enforces it).

- Paid ShinyApps environments strictly enforce HTTPS. If the underlying R session or load balancer thinks it is running on HTTP (even if the browser shows HTTPS), it might refuse to set secure cookies. Ensure your `_auth0.yml` file and Auth0 Application settings consistently use `https://` everywhere.

- Paid ShinyApps tiers often use multiple R worker processes to handle traffic. If Worker A initiates the login (saving the `state` in its memory) but Worker B receives the callback from Auth0, Worker B won’t recognize the `state` and will reject the login.  
The `auth0` R package needs to use a session store that is shared across workers, or you need to configure your ShinyApps deployment to use “sticky sessions” (so a user always hits the same worker).  
Review the `auth0` package documentation for configuring shared session storage (like saving the state in a file or database instead of RAM) if your paid tier utilizes multiple concurrent workers.

Let me know if you have any other questions!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![deym2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/deym2/32/70868_2.png) [@deym2](https://community.auth0.com/u/deym2)\
**Post date:** [May 1, 2026, 2:09pm UTC](https://community.auth0.com/t/after-a-successful-login-the-code-parameter-in-the-url-keeps-changing-and-my-apps-doesnt-load/199451/7 "2026-05-01T14:09:09Z")

</div>

> [@nik.baleca](#):
>
> configuring shared session storage (like saving the state in a file or database instead of RAM)

Hi, thank you for your reply! Points 1 and 2 are checked (multiple times). Third point could be the problem since we are in fact using multiple workers. Although, the previous version used many workers as well and it didn’t have the session problem. We are going to reduce it to 1 worker to confirm the problem, and then configuring the shared session storage

---

<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 15, 2026, 2:09pm UTC](https://community.auth0.com/t/after-a-successful-login-the-code-parameter-in-the-url-keeps-changing-and-my-apps-doesnt-load/199451/8 "2026-05-15T14:09:15Z")

</div>

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