Azure OAuth

I am running a panel app on azure app services. And i have managed to add authentication. The login system works with microsoft accounts as expected. However, I am unable to read that information into my application.

Specifically pn.state.user, pn.state.access_token and pn.state.user_info are all returning None.

I have all the environment variables populated oauth_key, oauth_secret and tennant_id etc as per the documentation
https://panel.holoviz.org/user_guide/Authentication.html#oauth-providers

This is a bit hard to reproduce a MRE, and there are no errors or warnings in the logs to why this is the case. I was just hoping someone here had got this working and could provide some insight.

UPDATE

I moved from environment variables to CLI arguments and things get rather strange. My command is:

python -m panel serve app2.py --port 8000 --address 0.0.0.0 --unused-session-lifetime 5000 --check-unused-sessions 5000 --allow-websocket-origin='***'--oauth-provider="azure" --oauth-extra-params="{'tenant': '***'}" --oauth-key="***" --oauth-secret="***" --cookie-secret="***" --oauth-redirect-uri="***"

I get the following error:

ERROR: invalid syntax (<unknown>, line 1)

So interestingly I tried to break this down, and put it together argument by argument. If I leave out the oauth-secret it gives me the error saying it needs to be included as expected, then when i put all the arguments in I get the above.

When I run this command locally no error is present, only when I am running it on my Azure web app. Note: This app is running perfectly fine without the authentication part. Has anyone run into this?

Solved

Leaving out the tenant id seemed to solve it. No idea why