Skip to main content

A streamlit component that creates a user login form connected to a Supabase DB. It lets users create a new username and password, login to an existing account, or login as an anonymous guest.

Project description

:lock: st-login-form

A streamlit component that creates a user login form connected to a Supabase DB. It lets users create a new username and password, login to an existing account, or login as an anonymous guest.

Form screenshot

The login form collapses after login to no occupy screen-space.

:computer: Demo app

Open in Streamlit

:construction: Installation instructions

  1. Install st-login-form
pip install st-login-form
  1. Create a Supabase project as mentioned here
  2. Create a table to store the usernames and passwords. The table name and column names can be as per your choice.
CREATE TABLE users (
    username text not null default ''::text,
    password text not null,
    constraint users_pkey primary key (username),
    constraint users_username_key unique (username),
    constraint users_password_check check (
      (
        length(
          trim(
            both
            from
              password
          )
        ) > 1
      )
    ),
    constraint users_username_check check (
      (
        length(
          trim(
            both
            from
              username
          )
        ) > 1
      )
    )
  ) tablespace pg_default;
  1. Follow the rest of the steps from here to connect your Streamlit app to Supabase

:pen: Usage instructions

login_form() sets session_state["authenticated"] to True if the login is successful, session_state["username"] to the username or new or existing user, and to None for guest login.

import streamlit as st

from streamlit_login import login_form

login_form()

if st.session_state["authenticated"]:
    if st.session_state["username"]:
        st.success(f"Welcome {st.session_state['username']}")
    else:
        st.success("Welcome guest")
else:
    st.error("Not authenticated")

See demo in Streamlit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

st-login-form-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

st_login_form-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file st-login-form-0.1.0.tar.gz.

File metadata

  • Download URL: st-login-form-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for st-login-form-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d133936b99d06234793e1678cfc05a1532c7ea311622168671271272374d6bb5
MD5 3a6400fbfb2021ae811bd3a113d4b5ee
BLAKE2b-256 4d8d3330911713201dba1d91e25498b6f0c68a9eedceac58198312d610961f66

See more details on using hashes here.

File details

Details for the file st_login_form-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: st_login_form-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for st_login_form-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 303a6c926e79e2c9a6da18ec9aa66f0fd44dd1dabb8115e6d095767f2038caab
MD5 a430233db976248c55a53a254169c37d
BLAKE2b-256 54c25ea601f0bc9438507ed377cdf651d7375f0634942ca2b82d572739fb86ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page