FirebaseAuth
fastagency.ui.mesop.auth.firebase.FirebaseAuth #
FirebaseAuth(
sign_in_methods: list[Literal["google"]],
config: FirebaseConfig,
allowed_users: Union[
list[str],
Callable[[dict[str, Any]], bool],
Literal["all"],
],
)
Initialize the Firebase Auth provider.
PARAMETER | DESCRIPTION |
---|---|
sign_in_methods | List of authentication methods to enable. Currently only supports ["google"]. |
config | Firebase configuration containing project settings. TYPE: |
allowed_users | Specifies user access control: - List[str]: List of allowed email addresses - Callable: Function taking decoded token and returning boolean - "all": Allows all authenticated users (default) TYPE: |
RAISES | DESCRIPTION |
---|---|
TypeError | If sign_in_methods is not a list |
ValueError | If no sign-in methods specified, unsupported methods provided, or GOOGLE_APPLICATION_CREDENTIALS environment variable is missing |
Source code in fastagency/ui/mesop/auth/firebase/firebase_auth.py
UN_AUTHORIZED_ERROR_MESSAGE class-attribute
instance-attribute
#
UN_AUTHORIZED_ERROR_MESSAGE = "You are not authorized to access this application. Please contact the application administrators for access."
auth_component #
Source code in fastagency/ui/mesop/auth/firebase/firebase_auth.py
create_security_policy #
Source code in fastagency/ui/mesop/auth/firebase/firebase_auth.py
is_authorized #
Check if the user is authorized based on the token and allowed_users configuration.
PARAMETER | DESCRIPTION |
---|---|
token | The decoded Firebase JWT token containing user information. Must include an 'email' field for validation. |
RETURNS | DESCRIPTION |
---|---|
bool | True if the user is authorized, False otherwise. TYPE: |
RAISES | DESCRIPTION |
---|---|
TypeError | If allowed_users is not of type str, list, or Callable. |
ValueError | If email field is missing in the Firebase token. |