i was able to extract fragments using streamlit-url-fragment module in streamlit version 1.8.1 but unable to do the same in ver 1.14.1.
This is happening due to auto refresh that is happening in browser address bar and removing url fragments automatically.
Steps to reproduce
Try Passing URL fragments for example below -
127.0.0.0:8051/#access_token=XYZ&token_type=Bearer
Hi @Caroline,
Thank you for looking into the issue, please find the code snippet below -
import streamlit as st
from streamlit_url_fragment import get_fragment
if __name__ == "__main__":
# -- Header Information
logger.info("Loading page configurations")
st.set_page_config(
page_title='Page 1',
page_icon='./images/xyz.png',
layout='centered',
initial_sidebar_state='auto')
current_value = get_fragment()
if current_value is None:
st.stop():
print("current_value", current_value)
Here i am trying to extract # fragments from the url.
Sample URL - 127.0.0.0:8051/#access_token=XYZ&token_type=Bearer
Is there a reason you’re using 1.14 rather than the most recent release? Also, please check out our guide on posting questions and update your code snippet to be formatted properly.
@Caroline - I tried it with the most recent Streamlit version also, but was facing the same issue.
Were you able to reproduce the issue i explained?
Quick Question - is there a way to get Request URL in Streamlit ?
We’ve experienced the same issue. We need to get a token from the fragment, but unfortunately anything after the # in the url is removed when the page loads.
Unfortunately even after many attempts we were unable to fix it, and so we had to reverted back to 1.9, which is the latest version without the issue.
@dclin Same for me as for @Ketan_Sharma, our token retrieval only supports returning the token as a fragment, not as a query param. Unfortunately there seems to be no way to disable Streamlit from removing the fragments.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.