@nuralogix.ai/dfx-api-client
Version:
DeepAffex API JavaScript Client Library
97 lines (62 loc) • 2.49 kB
Markdown
[.ai/dfx-api-client](../../index.md) / [HTTP](../../http/index.md) / Auths
# Auths
Auths end points
These endpoints provide user/device authentication.
### Sample code
```js
const apiClient = client();
const data = {
Token: 'your-old-token'
RefreshToken: 'your-old-refresh-token'
};
const response = await apiClient.http.auths.renew(data);
const { status, body } = response;
if (status !== '200') {
/**
* TypeScript knows that once we are inside this block, the only response
* shape that matches a non "200" response is the ErrorResponse
*/
throw body;
}
/** Otherwise the shape of the response is RenewToken200Response */
console.log(body.RefreshToken);
```
### Methods
- [renew](#renew)
- [requestLoginCode](#requestlogincode)
- [requestResetPasswordLink](#requestresetpasswordlink)
### renew
▸ **renew**(`data`)
Renew user/device access and refresh token. When you register a license or login with
user's credentials, a pair of Token and RefreshToken is sent to a client. The client
needs to send the matching pair to exchange it with a new pair. The old pair will not
be valid after calling this endpoint. RefreshToken is one-time use.
Endpoint Action ID = 2304
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`AuthRenewTokenRequest`](./interfaces/AuthRenewTokenRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`AuthRenewToken200Response`](./interfaces/AuthRenewToken200Response.md)\>
___
### requestLoginCode
▸ **requestLoginCode**(`data`)
Request to send login code.
Endpoint Action ID = 2303
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`AuthLoginCodeRequest`](./interfaces/AuthLoginCodeRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`AuthLoginCodeSent200Response`](./interfaces/AuthLoginCodeSent200Response.md)\>
___
### requestResetPasswordLink
▸ **requestResetPasswordLink**(`data`)
Request to send password reset link to user's email.
Endpoint Action ID = 2300
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`AuthResetPasswordLinkRequest`](./interfaces/AuthResetPasswordLinkRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`AuthResetPasswordLink200Response`](./interfaces/AuthResetPasswordLink200Response.md)\>