get_user function of the ProviderConfigs class.
This class can be imported from the squirrels.auth or the squirrels module.
Constructor
Creates aRegisteredUser object.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Represents a registered user in the system
get_user function of the ProviderConfigs class.
This class can be imported from the squirrels.auth or the squirrels module.
RegisteredUser object.
def __init__(
self, *, username: str, access_level: Literal['admin', 'member'],
custom_fields: CustomUserFields
) -> None:
Hide arguments
from squirrels import auth, arguments as args
@auth.provider(
name="google", label="Google",
icon="https://www.google.com/favicon.ico"
)
def google_auth_provider(sqrl: args.AuthProviderArgs) -> auth.ProviderConfigs:
def get_sqrl_user(claims: dict) -> auth.RegisteredUser:
custom_fields = auth.CustomUserFields() # or the derived class
return auth.RegisteredUser(
username=claims["email"],
access_level="member",
custom_fields=custom_fields
)
provider_configs = auth.ProviderConfigs(
client_id=sqrl.env_vars["GOOGLE_CLIENT_ID"],
client_secret=sqrl.env_vars["GOOGLE_CLIENT_SECRET"],
server_url="https://accounts.google.com",
client_kwargs={"scope": "openid email profile"},
get_user=get_sqrl_user
)
return provider_configs
Was this page helpful?