**Source URL:** https://limited.veevavault.dev/medical/omnichannel/api-reference/25.2/methods/onlogin.md

# onLogin()

Notifies Vault when a user has successfully authenticated and sets the `AgentStatus`.

## Parameters {#parameters}

<FieldTable>
| Name | Type | Description |
| --- | --- | --- |
| `agentStatus` | `AgentStatus` | The user's telephony status.Allowed values are `AgentStatus.AVAILABLE` and `AgentStatus.OFFLINE`.If not provided, the default is `AgentStatus.OFFLINE`. |
</FieldTable>

## Example {#example}

<CodeExample title="">
```
import { omniconnectEvent, AgentStatus} from "./vault-medical-omniconnect-25.1.2-release12649.js";


// Authenticate user with OFFLINE agent status
function userAuthenticatedWithOfflineStatus() {
    omniconnectEvent.onLogin()
}


// Authenticate user with AVAILABLE agent status
function userAuthenticatedWithAvailableStatus() {
    omniconnectEvent.onLogin(AgentStatus.AVAILABLE)
}

```
</CodeExample>

---

**Previous:** [onDisconnect()](/medical/omnichannel/api-reference/25.2/methods/ondisconnect)  
**Next:** [onLogout()](/medical/omnichannel/api-reference/25.2/methods/onlogout)