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

# Login

> Sign in with a browser and authenticate the SDK client as a saved login.

`valkyrie login` uses these functions. A saved login is a [`LoginSession`](https://docs.valkyrie.vals.ai/reference/sdk/models/login#login-session), and `ValkyrieConfig` picks it up when no access key is set.

## device\_login

Sign in to a Tracker with the OAuth device flow and return the new, unsaved login.

`announce(link, user_code)` is called once with the page the user opens and the code they confirm there.
The call blocks until the login is approved, denied or expires. Call `save()` and `remember()` on the
result to keep it. Raises `ValkyrieConfigError` when the login service refuses or the code expires, and
`ValkyrieTransportError` when the Tracker or login service can't be reached.

```python Signature theme={null}
def device_login(
    tracker_url: str,
    announce: Callable[[str, str], None],
    *,
    timeout: float = 30,
    transport: httpx.BaseTransport | None = None,
) -> LoginSession
```

### Parameters

tracker\_urlrequired · str

announcerequired · Callable\[\[str, str], None]

timeoutoptional · float · default: `30`

transportoptional · httpx.BaseTransport | None · default: `None`

### Returns

[`LoginSession`](https://docs.valkyrie.vals.ai/reference/sdk/models/login#login-session)

## SessionAuth

Send requests as a saved login, refreshing it before it expires and saving the rotated tokens.

Pass it as `ValkyrieClient(auth=SessionAuth(session))` to act as that login even when `VALKYRIE_API_KEY` is set.

```python Signature theme={null}
SessionAuth(session: LoginSession) -> SessionAuth
```

### Parameters

sessionrequired · [`LoginSession`](https://docs.valkyrie.vals.ai/reference/sdk/models/login#login-session)

### Returns

SessionAuth


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.