AWS Cognito : [amazoncognito.com refused to connect]

Whats Up Streamlit Family.

I have set up user authentication through cognito and it works perfectly.

However when I deploy my app via streamlit cloud the signin/signup links return the error
[ amazoncognito.com refused to connect.]

But if i copy the link and paste it in my browser it works. Any thoughts on how to fix this?

Hey @Syrup,

Thanks for sharing your question! Can you share a link to your GitHub repo and/or a code snippet so we can try to reproduce this behavior?

Thanks for the response I posted the code below

‘’’
#SignIn Button That Brings User Back To Homepage
sign_in_to_homepage = sidebar.markdown(‘’’

Sign In

‘’', unsafe_allow_html=True)

‘’’

#SignIn Button That Brings User Back To Homepage
        sign_in_to_homepage = sidebar.markdown(''' <a target="_self" href="https://catalyst-app.auth.us-east-2.amazoncognito.com/oauth2/authorize?response_type=code&client_id=1akri4eieduipi7j8beohroteu&scope=email+openid+phone&redirect_uri=https%3A%2F%2Fcatalyst.streamlit.app">
                            <button>
                                Sign In
                                </button>
                            </a>''', unsafe_allow_html=True)

The link works fine when i run this locally and if i just copy and paste the link in my browser. (Even the link works here in the button above)However whenever I click on this button via the app thats deployed running via the streamlit cloud I get the error message below from my browser

the app url in the streamit cloud that is not working is: https://catalyst.streamlit.app/

I posted the code above

Hi, @Syrup. Have you figured out the solution? I am having the same issue.

Or did you discover an other option? TY

I am having the same error.

This is my github repo for the demo:

This is the deployment url on streamlit cloud:

Please, any one who have solve this issue should please, drop some help.

To make it work for me on Streamlit Cloud, I simply need to alter the following code:

html_button_login = (
    html_css_login
    + f"<a href='{login_link}' class='button-login' target='_blank'>Log In</a>"
)
html_button_logout = (
    html_css_login
    + f"<a href='{logout_link}' class='button-login' target='_blank'>Log Out</a>"
)

I’m facing the same issue too. Any proven ways to solve it

I am facing the same issue, the only way I could solve it is using target=_blank as commented by @matheus.lenzi but it looks a bit odd needing to open a new tab for login.