Skip to content

Commit 71d60e4

Browse files
authored
PAS-578 | Clarify MGAT TTL (#147)
1 parent ada8c16 commit 71d60e4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/guide/api.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ ApiSecret: myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4
162162
Content-Type: application/json
163163
164164
{
165-
"userId": "123"
165+
"userId": "123",
166+
"timeToLive": 30
166167
}
167168
```
168169

@@ -173,7 +174,8 @@ const apiUrl = 'https://v4.passwordless.dev';
173174

174175
// Generate an authentication token, side-stepping the usual signin process.
175176
const payload = {
176-
userId: '107fb578-9559-4540-a0e2-f82ad78852f7'
177+
userId: '107fb578-9559-4540-a0e2-f82ad78852f7', // ID of the user to generate the token for.
178+
timeToLive: 30 // Time in seconds the token is valid for. Default is 120 seconds.
177179
};
178180

179181
// POST the user ID to the Passwordless.dev API using your API private secret.
@@ -189,6 +191,10 @@ const response = await fetch(apiUrl + '/signin/generate-token', {
189191

190192
:::
191193

194+
::: tip
195+
By default, manually generated authentication tokens are valid for 120 seconds. You can adjust this by setting the `timeToLive` parameter in the request body.
196+
:::
197+
192198
### Response
193199

194200
If successful, the `/signin/generate-token` endpoint will return a response object, for example:

0 commit comments

Comments
 (0)