Hey @xu2xulim, glad itâs helped! The cookie is saved as a JWT (JSON web token) where the integrity of its contents is verified using a hashed signature. Therefore, Iâm inclined to say that there is no need to hide the cookie name since even if someone comes across the cookie itself, they will not be able to tamper with its contents. However, if it does give you peace of mind, then by all means yes you can conceal it. The cookieâs key on the other hand must be kept private as it can be misused. You can read more about JWTâs here.
Thanks for your effort. It helped me alot ⊠I am wondering if there is a way to use this component with multi level authentication⊠For example to allow admin to access all features while other users access to limited features⊠thanks in advance
Hi @Afahim, glad it was useful. You can simply create a username called âadminâ or anything similar and give them advanced user privileges if they login, i.e. have an if statement to check if username == âadminâ and then render the content that only the admin should view. Regards.
How do i add
-
a signup page here
1.1 Looking to add signup : append names = [âxâ] => [âxâ,âyâ]
1.2 Append password : passwords = [â1â] =>[â1â,â2â] -
Reset Password for a given user ?
2.1 Reset password for a given user
Hi @naashonomics, I am working on an update for a user registration form that will be released in the near future, as soon as itâs ready I will update everyone on this channel. Cheers.
how do we use st.session_state[ânameâ] in multipage streamlit application ? thanks in advance
You can retrieve it exactly the way you have written it - st.session_state[ânameâ], there is no restriction regarding multipage apps, you can access you session state variables in any page.
@mkhorasani thank you very much for your great work, now since the official multipage apps from streamlit has been released, how can we use this streamlit authenticator for the official multipage apps? can you give an example, thank you
@streamlit4crypto2022 youâre most welcome. You can use streamlit-authenticator in the same way that you previously would use it. Invoke the login widget on your main page, then access the authentication_status variable through session state i.e. st.session_state[âauthentication_statusâ] on all your other pages to authenticate your user on to each and every page. Session state is persistent across all pages.
Is there a way to not show the login screen for a couple of seconds, when the user is already logged and the app is refresh?
Hello, Iâve been looking forward to try this on, so I copy/paste the code to test it out, but when I tried to run it, the app kept reloading itself before I put the credentials, do you know how can I fix it?
Can you share your code please?
Will look into it.
Dear all, the latest version of Streamlit-Authenticator v0.2.1 has just been released with the following new features:
- Reset password widget
- Register new user widget
- Forgot password widget
- Forgot username widget
- Update user details widget
Aswell as a whole host of other minor updates.
Enjoy!
Hello @mkhorasani , I am facing an error TypeError: init() got multiple values for argument âcookie_expiry_daysâ
can anyone help me solve this
Please note that as of v0.2.1, the names, usernames, and passwords are passed as one combined dictionary to the Authenticate class. Please refer to the readme file for further instructions on what arguments to pass.
Hello,
I loaded the yam file, and then, made this:
authenticator = stauth.Authenticate(
config[âcredentialsâ],
config[âcookieâ][ânameâ],
config[âcookieâ][âkeyâ],
config[âcookieâ][âexpiry_daysâ]),
config[âpreauthorizedâ]
)
name, authentication_status, username = authenticator.login(âLoginâ, âmainâ)
if authentication_status:
st.write(fâWelcome {name}')
st.title(âSome contentâ)
authenticator.logout(âLogoutâ, âmainâ)
elif authentication_status == False:
st.error(âUsername/password is incorrectâ)
elif authentication_status == None:
st.warning(âPlease enter your username and passwordâ)
But, when I press the login button, nothing happens, just this:
could u help me, plz?
Dear Gabriel,
Iâm not entirely sure what the problem may be, but can you please check that you are using the following versions of packages:
"PyJWT >=2.3.0",
"bcrypt >= 3.1.7",
"PyYAML >= 5.3.1",
"streamlit >= 0.86",
"extra-streamlit-components >= 0.1.55"
Hi!
Yes, im using the same versions of packages!
Im trying to solve, but, with no success
I did have what looks like the same issue and it was due to having installed the jwt
package instead of the pyjwt
package (very easy to mix the two together, they also both import with import jwt
). If this is the case you might see in the log a warning that says that jwt
does not have decode
method (or something similar, I do not remember the details).