@digitalpersona/authentication
Version:
DigitalPersona Authentication API
33 lines (18 loc) • 1.54 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@digitalpersona/authentication](./authentication.md) > [PushOtpAuth](./authentication.pushotpauth.md) > [authenticate](./authentication.pushotpauth.authenticate.md)
## PushOtpAuth.authenticate() method
Authenticates the user using a Push Notification on the user's registered mobile device.
<b>Signature:</b>
```typescript
authenticate(identity: User | JSONWebToken): Promise<JSONWebToken>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| identity | <code>User | JSONWebToken</code> | a or a JSON Web Token. |
<b>Returns:</b>
`Promise<JSONWebToken>`
a promise to return a JSON Web Token containing a claim (`crd`<!-- -->) showing the fact a OTP was used. To resolve the promise, the user must accept a Push Notification sent to their mobile device. Will reject if authentication fails.
## Remarks
If the `identity` parameter is a user name, a new token will be created. If the `identity` parameter is a JSON Web Token, an updated token will be returned.
The user must have a mobile device with a DigitalPersona authenticator app installed and registered in the DigitalPersona server. The user will receive a Push Notification on their mobile device via the app and must accept the notification to proceed. The promise returned by the method will be resolved when the user accepts the notification, otherwise it will reject with a timeout error.