forked from authorizerdev/authorizer-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
190 lines (165 loc) · 3.55 KB
/
Copy pathtypes.ts
File metadata and controls
190 lines (165 loc) · 3.55 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
export type ConfigType = {
authorizerURL: string;
redirectURL: string;
clientID: string;
extraHeaders?: Record<string, string>;
};
export type User = {
id: string;
email: string;
preferred_username: string;
email_verified: boolean;
signup_methods: string;
given_name?: string | null;
family_name?: string | null;
middle_name?: string | null;
nickname?: string | null;
picture?: string | null;
gender?: string | null;
birthdate?: string | null;
phone_number?: string | null;
phone_number_verified?: boolean | null;
roles?: string[];
created_at: number;
updated_at: number;
};
export type AuthToken = {
message?: string;
access_token: string;
expires_in: number;
id_token: string;
refresh_token?: string;
user?: User;
};
export type Response = {
message: string;
};
export type Headers = Record<string, string>;
export type LoginInput = {
email: string;
password: string;
roles?: string[];
scope?: string[];
};
export type SignupInput = {
email: string;
password: string;
confirm_password: string;
given_name?: string;
family_name?: string;
middle_name?: string;
nickname?: string;
picture?: string;
gender?: string;
birthdate?: string;
phone_number?: string;
roles?: string[];
scope?: string[];
redirect_uri?: string;
};
export type MagicLinkLoginInput = {
email: string;
roles?: string[];
scopes?: string[];
state?: string;
redirect_uri?: string;
};
export type VerifyEmailInput = { token: string };
export type GraphqlQueryInput = {
query: string;
variables?: Record<string, any>;
headers?: Headers;
};
export type MetaData = {
version: string;
client_id: string;
is_google_login_enabled: boolean;
is_facebook_login_enabled: boolean;
is_github_login_enabled: boolean;
is_linkedin_login_enabled: boolean;
is_apple_login_enabled: boolean;
is_email_verification_enabled: boolean;
is_basic_authentication_enabled: boolean;
is_magic_link_login_enabled: boolean;
is_sign_up_enabled: boolean;
is_strong_password_enabled: boolean;
};
export type UpdateProfileInput = {
old_password?: string;
new_password?: string;
confirm_new_password?: string;
email?: string;
given_name?: string;
family_name?: string;
middle_name?: string;
nickname?: string;
gender?: string;
birthdate?: string;
phone_number?: string;
picture?: string;
};
export type ForgotPasswordInput = {
email: string;
state?: string;
redirect_uri?: string;
};
export type ResetPasswordInput = {
token: string;
password: string;
confirm_password: string;
};
export type SessionQueryInput = {
roles?: string[];
};
export type IsValidJWTQueryInput = {
jwt: string;
roles?: string[];
};
export type ValidJWTResponse = {
valid: string;
message: string;
};
export enum OAuthProviders {
Apple = 'appe',
Github = 'github',
Google = 'google',
Facebook = 'facebook',
LinkedIn = 'linkedin',
}
export enum ResponseTypes {
Code = 'code',
Token = 'token',
}
export type AuthorizeInput = {
response_type: ResponseTypes;
use_refresh_token?: boolean;
response_mode?: string;
};
export type AuthorizeResponse = {
state: string;
code?: string;
error?: string;
error_description?: string;
};
export type RevokeTokenInput = {
refresh_token: string;
};
export type GetTokenInput = {
code?: string;
grant_type?: string;
refresh_token?: string;
};
export type GetTokenResponse = {
access_token: string;
expires_in: number;
id_token: string;
refresh_token?: string;
};
export type ValidateJWTTokenInput = {
token_type: 'access_token' | 'id_token' | 'refresh_token';
token: string;
roles?: string[];
};
export type ValidateJWTTokenResponse = {
is_valid: boolean;
};