Streamlit Authentication - Page navigation

I have been using streamlit-authenticator in a multipage streamlit app,
whenever I reload the page its going to login and shows the login screen and then navigates back to the original page.
I donโ€™t want this to happen. Please help me find a solution for this.

Hi @Naveen_Chekkapalli

Perhaps you can try the login app that @blackary had created https://app-app.streamlit.app/

Hereโ€™s the corresponding repo for the above mentioned app GitHub - blackary/streamlit-login

Sorry for not mentioning the issue clearly,
I am using cookies to store the user session when user logs in, using cookie manager. But when I reload the page, the application goes to the login page and the authentication happens there and coming back to the original(target) page.

Iโ€™ve tried using auth._check_cookie() in the target page

if 'authentication_status' not in st.session_state or not st.session_state['authentication_status']:
    auth._check_cookie()
    if 'authentication_status' not in st.session_state or not st.session_state['authentication_status']:
        # go to login page
    
else:
    # target page

authentication status in st.session_state is set to True in _check_cookie function, but here the app still goes back to the login page.

If I use sleep(10) after the auth._check_cookie(), it is working.

Please help me resolve this

Hey @Naveen_Chekkapalli,

We fixed a couple issues for st.switch_page() in the latest version 1.31.1, might try that and see if it helps.

If not, any chance you could share a longer app snippet or point to a repo to help us repro this issue? Iโ€™m curious to take a look.

Thanks!