When attempting to log in on a self-hosted instance, the Plex authentication redirect fails. Instead of generating a valid PIN and passing the state parameter, the application redirects to Plex with code=undefined and id=undefined in the URL parameters.
Because the parameters are undefined, the Plex authentication page throws an error ([Parser] Unable to parse JSON), and the login cannot be completed.
Steps to Reproduce:
- Navigate to the self-hosted Plexio instance.
- Click the "Login" button.
- Observe the redirect URL to app.plex.tv/auth/.
- Note that the forwardUrl parameter contains code=undefined&id=undefined.
Expected Behavior:
The application should successfully generate a PIN via the backend, and the redirect URL should contain the modern state parameter (as seen on the hosted instance) rather than undefined legacy code and id parameters.
Elfhosted's instance works fine for some reason.

When attempting to log in on a self-hosted instance, the Plex authentication redirect fails. Instead of generating a valid PIN and passing the state parameter, the application redirects to Plex with code=undefined and id=undefined in the URL parameters.
Because the parameters are undefined, the Plex authentication page throws an error ([Parser] Unable to parse JSON), and the login cannot be completed.
Steps to Reproduce:
Expected Behavior:
The application should successfully generate a PIN via the backend, and the redirect URL should contain the modern state parameter (as seen on the hosted instance) rather than undefined legacy code and id parameters.
Elfhosted's instance works fine for some reason.