You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get a list of all the configured OAuth providers. Useful for creating a [custom login page](/guide/authjs/custom-pages#sign-in-page). Returns an array of `Provider`.
You can also pass the `callbackUrl` option to redirect a user to a certain page, after they completed the action. This can be useful when a user attempts to open a page (`/protected`) but has to go through external authentication (e.g., via their google account) first.
185
172
:::
186
173
187
-
:::warning Local / Refresh Only
188
-
`signUp` is only avalible for the refresh and local providers!
You can also pass the `callbackUrl` option to redirect a user to a certain page, after they completed the action. This can be useful when a user attempts to open a page (`/protected`) but has to go through external authentication (e.g., via their google account) first.
The fetched refreshToken that can be used to obtain a new access token . E.g. a refreshToken looks like this: `eyDFSJKLDAJ0-3249PPRFK3P5234SDFL;AFKJlkjdsjd.dsjlajhasdji89034`
263
250
264
-
:::warning Refresh Only
265
-
`refreshToken` is only avalible for the refresh provider!
251
+
:::warning Local Only
252
+
`refreshToken` is only avalible for the local provider!
266
253
:::
267
254
268
255
### `refresh`
@@ -297,43 +284,6 @@ lastRefreshedAt.value
297
284
```
298
285
299
286
```ts [local]
300
-
const {
301
-
status,
302
-
loading,
303
-
data,
304
-
lastRefreshedAt,
305
-
token,
306
-
rawToken,
307
-
setToken,
308
-
clearToken
309
-
} =useAuthState()
310
-
311
-
// Session status, either `unauthenticated`, `loading`, `authenticated`
312
-
status.value
313
-
314
-
// Whether any http request is still pending
315
-
loading.value
316
-
317
-
// Session data, either `undefined` (= authentication not attempted), `null` (= user unauthenticated), or session / user data your `getSession`-endpoint returns
318
-
data.value
319
-
320
-
// Time at which the session was last refreshed, either `undefined` if no refresh was attempted or a `Date` of the time the refresh happened
321
-
lastRefreshedAt.value
322
-
323
-
// The fetched token that can be used to authenticate future requests. E.g., a JWT-Bearer token like so: `Bearer eyDFSJKLDAJ0-3249PPRFK3P5234SDFL;AFKJlkjdsjd.dsjlajhasdji89034`
324
-
token.value
325
-
326
-
// Cookie that containes the raw fetched token string. This token won't contain any modification or prefixes like `Bearer` or any other.
327
-
rawToken.value
328
-
329
-
// Helper method to quickly set a new token (alias for rawToken.value = 'xxx')
330
-
setToken('new token')
331
-
332
-
// Helper method to quickly delete the token cookie (alias for rawToken.value = null)
333
-
clearToken()
334
-
```
335
-
336
-
```ts [refresh]
337
287
const {
338
288
status,
339
289
loading,
@@ -362,24 +312,18 @@ lastRefreshedAt.value
362
312
// The fetched token that can be used to authenticate future requests. E.g., a JWT-Bearer token like so: `Bearer eyDFSJKLDAJ0-3249PPRFK3P5234SDFL;AFKJlkjdsjd.dsjlajhasdji89034`
363
313
token.value
364
314
365
-
// The fetched refreshToken that can be used to refresh the Token with refresh() methode.
366
-
refreshToken.value
367
-
368
315
// Cookie that containes the raw fetched token string. This token won't contain any modification or prefixes like `Bearer` or any other.
369
316
rawToken.value
370
317
371
-
// Cookie that containes the raw fetched refreshToken string.
372
-
rawRefreshToken.value
373
-
374
318
// Helper method to quickly set a new token (alias for rawToken.value = 'xxx')
375
319
setToken('new token')
376
320
377
-
// Helper method to quickly delete the token and refresh Token cookie (alias for rawToken.value = null and rawRefreshToken.value = null)
321
+
// Helper method to quickly delete the token cookie (alias for rawToken.value = null)
378
322
clearToken()
379
323
```
380
324
:::
381
325
382
-
:::warning Local and refresh providers:
326
+
:::warning Local provider:
383
327
Note that you will have to manually call getSession from useAuth composable in order to refresh the new user state when using setToken, clearToken or manually updating rawToken.value:
0 commit comments