-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathjwt.d.ts
50 lines (48 loc) · 1.2 KB
/
jwt.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import type { User, UserObject } from "next-auth"
import type { Token } from "next-auth/jwt"
declare module "next-auth" {
export interface UserObject {
user_id: number
username: string
email: string
is_staff: boolean
is_superuser: boolean
}
/**
* The shape of the user object returned in the OAuth providers' `profile` callback,
* or the second parameter of the `session` callback, when using a database.
*/
export interface User extends Token {
exp: number
user: UserObject
}
/**
* Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
*/
export interface Session extends User {
expires: string
}
}
declare module "next-auth/jwt" {
export interface RefreshedToken {
access: string
access_expiration: string
}
export interface Token extends RefreshedToken {
refresh: string
refresh_expiration: string
}
/**
* Returned by the `jwt` callback and `getToken`, when using JWT sessions
*/
export interface JWT extends User {
iat: number
jti: string
}
export interface DecodedJWT extends UserObject {
token_type: string
exp: number
iat: number
jti: string
}
}