Skip to content

Login Box not disappearing automatically #274

@nomivcastle

Description

@nomivcastle

Not sure if this is user error but after I log in with correct login details, the rest of the app loads below the login box but the box stays there.

Image

Code I am running:

import streamlit as st
import pandas as pd
import numpy as np
import psycopg2
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from datetime import datetime, timedelta
import streamlit_authenticator as stauth
import yaml
from yaml.loader import SafeLoader

with open('config.yaml') as file:
    config = yaml.load(file, Loader=SafeLoader)

authenticator = stauth.Authenticate(
    config['credentials'],
    config['cookie']['name'],
    config['cookie']['key'],
    config['cookie']['expiry_days']
)

try:
    authenticator.login()
except Exception as e:
    st.error(e)

if st.session_state.get('authentication_status'): 
    # Show Logout Button
    authenticator.logout()

    # Add custom CSS
    st.markdown("""
    <style>
        .main-header {
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 1rem;
        }
        .subheader {
            font-size: 1.5rem;
            font-weight: 500;
            margin-bottom: 1rem;
        }
        .card {
            padding: 1rem;
            border-radius: 0.5rem;
            background-color: #f5f5f5;
            margin-bottom: 1rem;
        }
    </style>
    """, unsafe_allow_html=True)

Notes:

  • The streamlit version I am running is 1.43.1
  • The streamlit-authenticator version I am running is 0.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions