voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
30 lines (17 loc) • 847 B
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/auth](./auth.md) > [getIdToken](./auth.getidtoken.md)
## getIdToken() function
Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.
<b>Signature:</b>
```typescript
export declare function getIdToken(user: User, forceRefresh?: boolean): Promise<string>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| user | [User](./auth.user.md) | The user. |
| forceRefresh | boolean | Force refresh regardless of token expiration. |
<b>Returns:</b>
Promise<string>
## Remarks
Returns the current token if it has not expired or if it will not expire in the next five minutes. Otherwise, this will refresh the token and return a new one.