> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pysquirrels.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RegisteredUser

> Represents a registered user in the system

Class representing a user that must be authenticated by logging in.

This is often used to define the user returned by the `get_user` function of the [ProviderConfigs](/references/python/auth/ProviderConfigs) class.

This class can be imported from the `squirrels.auth` or the `squirrels` module.

## Constructor

Creates a `RegisteredUser` object.

```python theme={null}
def __init__(
    self, *, username: str, access_level: Literal['admin', 'member'], 
    custom_fields: CustomUserFields
) -> None:
```

<Expandable title="arguments" defaultOpen>
  <ResponseField name="username" type="str">
    The unique username of the user
  </ResponseField>

  <ResponseField name="access_level" type="Literal['admin', 'member']">
    The access level of the user
  </ResponseField>

  <ResponseField name="custom_fields" type="CustomUserFields">
    Custom fields associated with the user
  </ResponseField>
</Expandable>

## Example

```python highlight={10-14} theme={null}
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
```
