Unable to successfully login with st.login for app running with work tenant

The auth works with this third party library: msal-streamlit-authentication · PyPI

However, I’m interested in migrating to streamlit core features approach as described in this tutorial: Use Microsoft Entra to authenticate users - Streamlit Docs
Following above tutorial to setup an app on custom domain and Azure Entra ID for my work organization.

My app is deployed on Azure web app
Unable to share full code, but attaching some snippets

[auth]
redirect_uri="https://www.test.company.com/oauth2callback"
cookie_secret="xxxxxxxxxxxx"
client_id="yyyyyyyyyyyyyyy"
client_secret="zzzzzzzzzzzzzzzzzz"
server_metadata_url="https://login.microsoftonline.com/{tenant_id_from_azure_entra_id}/v2.0/.well-known/openid-configuration"

NOTE: “https://www.test.company.com/oauth2callback” has been set for Web platform as suggested

Observation: For the 3rd party library, I was setting up single-page app instead of Web.

with st.sidebar:
    def login_screen():
        st.header("This app is private!")
        st.subheader("Please log in.")
        st.button("Log in with Microsoft", on_click=st.login)

    if not st.experimental_user.is_logged_in:
        login_screen()
    else:
        st.header(f"Welcome, {st.experimental_user.name}!")
        st.button("Log out", on_click=st.logout)

I end up with a HTTP ERROR 499 after a long time.
image

Streamlit version: 1.43.0
Python version: python:3.9-slim
I’m building my app as a docker image and directing Azure web app to execute this docker