> ## 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.

# provider

> Decorator to register an authentication provider

Decorator function to register an OAuth authentication provider.

The decorated function must:

* accept an argument `sqrl` of type [AuthProviderArgs](/references/python/arguments/AuthProviderArgs)
* return a [ProviderConfigs](/references/python/auth/ProviderConfigs) object

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

## Arguments

<ResponseField name="name" type="str" required>
  The name of the provider (must be unique, e.g., 'google')
</ResponseField>

<ResponseField name="label" type="str" required>
  The display label of the provider (e.g., 'Google')
</ResponseField>

<ResponseField name="icon" type="str" required>
  The URL of the icon for the provider
</ResponseField>

## Example

```python highlight={3-6} 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_user(user_info: dict) -> auth.RegisteredUser:
        # Convert OAuth user info to RegisteredUser
        pass
    
    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
```
