very-express 0.5.13 → 0.5.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.eslintrc.json +0 -0
  2. package/.gitattributes +0 -0
  3. package/.github/workflows/npm-start.yml +0 -0
  4. package/LICENSE +0 -0
  5. package/README.md +62 -62
  6. package/dist/index.js +421 -314
  7. package/dist/templates/_middlewares/Authentication.ts +8 -6
  8. package/dist/templates/_projectSettings/env +21 -21
  9. package/dist/templates/_projectSettings/package.json +49 -49
  10. package/dist/templates/_routes/oauth/OAuthRouteFactory.ts +7 -42
  11. package/dist/templates/_services/VexDbConnector.ts +8 -8
  12. package/dist/templates/_services/VexSystem.ts +5 -6
  13. package/dist/templates/_services/auth/JWTService.ts +168 -0
  14. package/dist/templates/_services/oauth/OAuthProfileMap.ts +69 -0
  15. package/dist/templates/_services/oauth/OAuthStrategyService.ts +92 -0
  16. package/dist/templates/_types/VexResponseError.ts +20 -0
  17. package/dist/templates/_types/responseObject.ts +7 -0
  18. package/dist/templates/_utils/hash.ts +47 -0
  19. package/dist/templates/_utils/index.ts +5 -3
  20. package/dist/templates/_utils/response.ts +102 -32
  21. package/dist/templates/jsonSchema/User.json +85 -82
  22. package/dist/templates/root/public/css/style.css +7 -7
  23. package/dist/templates/root/public/js/logincallback.js +18 -18
  24. package/dist/templates/root/public/js/mytokens.js +10 -10
  25. package/dist/templates/root/public/js/refreshtokens.js +22 -22
  26. package/docs/ForeignKey.md +0 -0
  27. package/docs/appGenerated/auth.md +0 -0
  28. package/docs/developmentNote.md +0 -0
  29. package/docs/releaseNote/v0-5-0.md +0 -0
  30. package/docs/roadMap/released.md +0 -0
  31. package/docs/roadMap/v0-6-0.md +0 -0
  32. package/docs/roadMap/v0-7-0.md +0 -0
  33. package/docs/vexJsonSchema.md +0 -0
  34. package/package.json +51 -51
  35. package/scripts/build.js +0 -0
  36. package/scripts/copyTsTemplates.js +0 -0
  37. package/scripts/merge.js +0 -0
  38. package/tsconfig.json +121 -121
  39. package/vex.config.json +36 -35
  40. package/dist/templates/_plugins/auth/jwt.ts +0 -85
  41. package/dist/templates/_plugins/auth/oauthVerify.ts +0 -86
  42. package/dist/templates/_plugins/auth/profileMapping.ts +0 -68
  43. package/dist/templates/_plugins/auth/token.ts +0 -29
  44. package/dist/templates/_types/response/index.ts +0 -10
  45. package/dist/templates/_types/response/responseCode.ts +0 -15
  46. package/dist/templates/_types/response/responseMsg.ts +0 -28
  47. package/dist/templates/_types/response/responseStatusCodeMap.ts +0 -70
  48. /package/dist/templates/{_plugins → _services}/auth/JWTKeyStore.ts +0 -0
@@ -0,0 +1,92 @@
1
+ // {{headerComment}}
2
+ import { UserModel, UserDocument } from "./../../_models/UserModel.gen";
3
+ import { User } from "./../../_types/User.gen";
4
+ import JWTService from "./../auth/JWTService.gen";
5
+ import OAuthProfileMap, { IProfile } from "./OAuthProfileMap.gen";
6
+ import utils from "../../_utils";
7
+
8
+
9
+ export default class OAuthStrategyService {
10
+
11
+ public async verify(accessToken: string, refreshToken: string, profile: IProfile, done: (error: any, user?: any) => void) : Promise<void> {
12
+ try {
13
+
14
+ let user: UserDocument;
15
+ const authUser = new OAuthProfileMap().map(profile);
16
+
17
+ // find user by authProfiles.authId or email
18
+ const existingUser = await UserModel.findOne<UserDocument>({
19
+ email: authUser.email,
20
+ $or: authUser.authProfiles?.map((p) => {
21
+ return { "authProfiles.authId": p.authId };
22
+ }),
23
+ });
24
+
25
+ // 1. create new user
26
+ if ( !existingUser ){
27
+ user = await this.createNewUser(authUser);
28
+ }
29
+ // 2. update existing user
30
+ else {
31
+ console.log("OAuthVerify UpdateUser");
32
+ user = await this.processExistingUser(authUser, existingUser);
33
+ }
34
+
35
+ // set req.user
36
+ done(null, {
37
+ provider: profile.provider,
38
+ profile: new JWTService().sanitizeUser(user),
39
+ });
40
+ }
41
+ catch(err) {
42
+ return done(err);
43
+ }
44
+ }
45
+
46
+ private async createNewUser(authProfile: User): Promise<UserDocument>{
47
+ utils.log.info("OAuthVerify > createNewUser");
48
+ const newUser = new UserModel(authProfile);
49
+ return await newUser.save();
50
+ }
51
+
52
+ private async processExistingUser( authUser: User, existingUser: UserDocument): Promise<UserDocument>{
53
+ utils.log.info("OAuthVerify > processExistingUser");
54
+
55
+ let userUpdated = false;
56
+ const authProfile = authUser.authProfiles?.[0] || undefined;
57
+ const userProfiles = existingUser.authProfiles as User["authProfiles"] || [];
58
+
59
+ if(!authProfile){
60
+ utils.log.errorNoExit("OAuthVerify > Invalid OAuth Callback \"authProfile\"");
61
+ throw new Error("Invalid OAuth Callback \"authProfile\"");
62
+ }
63
+
64
+ // B.1. check current provider exist in authProfiles
65
+ const providerExists = userProfiles.length > 0 && userProfiles.find((p: any) => {
66
+ return (p.provider === authProfile.provider) && (p.authId === authProfile.authId);
67
+ });
68
+
69
+ // B.2. add if not exist
70
+ if (!providerExists){
71
+ utils.log.info("OAuthVerify > add new provider",authProfile.provider);
72
+ userProfiles.push(authProfile);
73
+ userUpdated = true;
74
+ }
75
+ // B.3 update if username changed
76
+ else if (providerExists && providerExists.username !== authProfile.username){
77
+ utils.log.info("OAuthVerify > update username", authProfile.provider);
78
+ providerExists.username = authProfile.username;
79
+ userUpdated = true;
80
+ }
81
+
82
+ if (userUpdated){
83
+ utils.log.info("OAuthVerify > Update user");
84
+ return await existingUser.updateOne({ authProfiles: userProfiles });
85
+ }
86
+ else {
87
+ return existingUser;
88
+ }
89
+ }
90
+
91
+
92
+ }
@@ -0,0 +1,20 @@
1
+ import { ResponseCode } from "./../_utils/response.gen";
2
+ import utils from "../_utils/index";
3
+
4
+ export default class VexResponseError extends Error {
5
+ public status: number;
6
+ public ret_code: ResponseCode;
7
+ public ret_msg: any;
8
+
9
+ constructor(
10
+ status: number = 200,
11
+ code?: ResponseCode,
12
+ message?: string,
13
+ ) {
14
+ super(message);
15
+ this.name = "VexResponseError";
16
+ this.status = status;
17
+ this.ret_code = code || utils.response.code.SERVER_ERROR;
18
+ this.ret_msg = message || utils.response.msg.SERVER_ERROR;
19
+ }
20
+ }
@@ -0,0 +1,7 @@
1
+
2
+ export interface responseObject<T>{
3
+ ret_code : number,
4
+ ret_msg : string,
5
+ ret_time?: number,
6
+ result: T,
7
+ }
@@ -0,0 +1,47 @@
1
+ // {{headerComment}}
2
+ import crypto from "crypto";
3
+ import { User } from "../_types/User.gen";
4
+
5
+ /**
6
+ * Hashes a password with a salt (e.g., user email).
7
+ * @param plainPassword The plain text password to hash.
8
+ * @param salt The salt to use (e.g., user email).
9
+ * @param algorithm The hash algorithm (default: 'sha256').
10
+ * @returns The hashed password (hex encoded).
11
+ */
12
+ export function hashPassword(
13
+ plainPassword: string,
14
+ salt: string,
15
+ algorithm: "sha256" = "sha256"
16
+ ): string {
17
+ return crypto.createHash(algorithm).update(plainPassword + salt).digest("hex");
18
+ }
19
+
20
+ /**
21
+ * Verifies if a plain password (with salt) matches a given hashed password.
22
+ * @param user The user object containing email and authProfiles.
23
+ * @param plainPassword The plain text password to verify.
24
+ * @returns True if the password matches, false otherwise.
25
+ */
26
+ export function verifyPassword(
27
+ user: User,
28
+ plainPassword: string,
29
+ ): boolean {
30
+ if(!user.email || !user.authProfiles) {
31
+ console.error("User email or authProfiles missing for local auth's password verification.");
32
+ return false;
33
+ }
34
+
35
+ const hashedPassword = user.authProfiles.find((profile:any) => profile.provider === "local")?.password;
36
+ if(!hashedPassword) {
37
+ console.error("Local auth profile or password missing for user.");
38
+ return false;
39
+ }
40
+
41
+ return hashPassword(plainPassword, user.email) === hashedPassword;
42
+ }
43
+
44
+ export default {
45
+ hashPassword,
46
+ verifyPassword
47
+ };
@@ -1,11 +1,13 @@
1
+ import common from "./common.gen";
2
+ import hash from "./hash.gen";
1
3
  import logger from "./logger.gen";
2
4
  import response from "./response.gen";
3
5
  import validator from "./validator.gen";
4
- import common from "./common.gen";
5
6
 
6
7
  export default {
8
+ common,
9
+ hash,
7
10
  log : logger,
8
11
  response,
9
- validator,
10
- common
12
+ validator
11
13
  };
@@ -1,5 +1,4 @@
1
1
  import { Response } from "express";
2
- import { responseMsg, responseCode, responseStatusCodeMap, type ResponseCode } from "./../_types/response/index.gen";
3
2
 
4
3
  /**
5
4
  * @param res express response object
@@ -11,21 +10,21 @@ import { responseMsg, responseCode, responseStatusCodeMap, type ResponseCode } f
11
10
  */
12
11
  export function send<T = undefined>(
13
12
  res: Response,
14
- status: number = 200,
15
- body?:{
13
+ status: number = 200,
14
+ body?: {
16
15
  code?: ResponseCode,
17
- message?: string|null,
16
+ message?: string | null,
18
17
  result?: T,
19
18
  }
20
19
  ): Response<any, Record<string, any>> {
21
20
  const noBody = !body || (body.code === undefined && body.message === undefined && body.result === undefined);
22
21
 
23
- if(noBody){
22
+ if (noBody) {
24
23
  return res.status(status).send();
25
24
  }
26
- else{
27
- const code :ResponseCode | undefined = body?.code ?? responseStatusCodeMap.get(status) as ResponseCode | undefined;
28
- const msg :string | undefined = body?.message ?? (code ? responseMsg[code] : undefined);
25
+ else {
26
+ const code: ResponseCode | undefined = body?.code ?? responseStatusCodeMap.get(status) as ResponseCode | undefined;
27
+ const msg: string | undefined = body?.message ?? (code ? responseMessage[code] : undefined);
29
28
 
30
29
  return res.status(status)
31
30
  .header({
@@ -40,34 +39,105 @@ export function send<T = undefined>(
40
39
  }
41
40
  }
42
41
 
43
- export interface responseObject<T>{
44
- ret_code : number,
45
- ret_msg : string,
46
- ret_time?: number,
47
- result: T,
48
- }
42
+ const responseMessage = {
49
43
 
50
- export class VexResponseError extends Error {
51
- public status: number;
52
- public ret_code: ResponseCode;
53
- public ret_msg: any;
44
+ DB_CONN_ERR: "Database connection error",
45
+ SERVER_ERROR: "Unknown Server Error",
54
46
 
55
- constructor(
56
- status: number = 200,
57
- code?: ResponseCode,
58
- message?: string,
59
- ) {
60
- super(message);
61
- this.name = "VexResponseError";
62
- this.status = status;
63
- this.ret_code = code || responseCode.SERVER_ERROR;
64
- this.ret_msg = message || responseMsg.SERVER_ERROR;
65
- }
66
- }
47
+ success: "Success",
48
+
49
+ err_db_data: "Corrupted Database Record",
50
+
51
+ err_permission: "Permission Denied",
52
+
53
+ err_payload: "Invalid Request Payload",
54
+ err_query: "Invalid Request Query",
55
+ err_body: "Invalid Request Body",
56
+
57
+ err_validation: "Validation Error",
58
+ err_query_validation: "Query Validation Error",
59
+ err_body_validation: "Body Validation Error",
60
+
61
+ err_create: "Falied to Insert Data",
62
+ err_read: "Falied to Read Data",
63
+ err_update: "Falied to Edit Data",
64
+ err_delete: "Falied to Delete Data",
65
+ };
66
+
67
+ const responseCode = Object.keys(responseMessage).reduce((acc, key) => {
68
+ acc[key] = key as ResponseCode;
69
+ return acc;
70
+ }, {} as Record<string, ResponseCode>);
71
+
72
+ const responseStatusCodeMap = new Map<number, string>([
73
+ [100, "Continue"],
74
+ [101, "Switching Protocols"],
75
+ [102, "Processing"],
76
+ [103, "Early Hints"],
77
+ [200, responseCode.success],
78
+ [201, responseCode.success],
79
+ [202, responseCode.success],
80
+ [203, "Non-Authoritative Information"],
81
+ [204, "No Content"],
82
+ [205, "Reset Content"],
83
+ [206, "Partial Content"],
84
+ [207, "Multi-Status"],
85
+ [208, "Already Reported"],
86
+ [226, "IM Used"],
87
+ [300, "Multiple Choices"],
88
+ [301, "Moved Permanently"],
89
+ [302, "Found"],
90
+ [303, "See Other"],
91
+ [304, "Not Modified"],
92
+ [307, "Temporary Redirect"],
93
+ [308, "Permanent Redirect"],
94
+ [400, responseCode.err_payload],
95
+ [401, responseCode.err_permission],
96
+ [402, "Payment Required"],
97
+ [403, "Forbidden"],
98
+ [404, "Not Found"],
99
+ [405, "Method Not Allowed"],
100
+ [406, "Not Acceptable"],
101
+ [407, "Proxy Authentication Required"],
102
+ [408, "Request Timeout"],
103
+ [409, "Conflict"],
104
+ [410, "Gone"],
105
+ [411, "Length Required"],
106
+ [412, "Precondition Failed"],
107
+ [413, "Content Too Large"],
108
+ [414, "URI Too Long"],
109
+ [415, "Unsupported Media Type"],
110
+ [416, "Range Not Satisfiable"],
111
+ [417, "Expectation Failed"],
112
+ [418, "I'm a teapot"],
113
+ [421, "Misdirected Request"],
114
+ [422, "Unprocessable Content"],
115
+ [423, "Locked"],
116
+ [424, "Failed Dependency"],
117
+ [425, "Too Early"],
118
+ [426, "Upgrade Required"],
119
+ [428, "Precondition Required"],
120
+ [429, "Too Many Requests"],
121
+ [431, "Request Header Fields Too Large"],
122
+ [451, "Unavailable For Legal Reasons"],
123
+ [500, "Internal Server Error"],
124
+ [501, "Not Implemented"],
125
+ [502, "Bad Gateway"],
126
+ [503, "Service Unavailable"],
127
+ [504, "Gateway Timeout"],
128
+ [505, "HTTP Version Not Supported"],
129
+ [506, "Variant Also Negotiates"],
130
+ [507, "Insufficient Storage"],
131
+ [508, "Loop Detected"],
132
+ [510, "Not Extended"],
133
+ [511, "Network Authentication Required"],
134
+ ]);
135
+
136
+ export type ResponseCode = keyof typeof responseMessage;
67
137
 
68
138
  export default {
69
139
  send,
70
- msg: responseMsg,
71
- code: responseCode,
140
+ msg: responseMessage,
141
+ code: responseCode,
72
142
  statusCodeMap: responseStatusCodeMap,
73
143
  };
@@ -1,83 +1,86 @@
1
- {
2
- "type": "object",
3
- "x-documentConfig": {
4
- "methods": [
5
- "get",
6
- "getList",
7
- "post",
8
- "patch"
9
- ],
10
- "documentName": "User"
11
- },
12
- "properties": {
13
- "_id": {
14
- "type": "string",
15
- "x-format": "ObjectId",
16
- "index": true
17
- },
18
- "authProfiles": {
19
- "type": "array",
20
- "items": {
21
- "type": "object",
22
- "properties": {
23
- "provider": {
24
- "type": "string",
25
- "index": true
26
- },
27
- "authId": {
28
- "type": "string",
29
- "index": true
30
- },
31
- "username": {
32
- "type": "string"
33
- }
34
- },
35
- "required": []
36
- }
37
- },
38
- "email": {
39
- "type": "string",
40
- "format": "email",
41
- "index": true
42
- },
43
- "name": {
44
- "type": "string",
45
- "maxLength": 64,
46
- "required": true
47
- },
48
- "active": {
49
- "type": "boolean",
50
- "default": true,
51
- "required": true
52
- },
53
- "locale": {
54
- "type": "string",
55
- "maxLength": 8
56
- },
57
- "roles": {
58
- "type": "array",
59
- "x-vexData": "role",
60
- "items": {
61
- "type": "string",
62
- "enum": [
63
- "visitor",
64
- "member",
65
- "admin"
66
- ]
67
- },
68
- "default": [
69
- "visitor"
70
- ]
71
- },
72
- "profileErrors": {
73
- "type": "array",
74
- "items": {
75
- "type": "string"
76
- }
77
- }
78
- },
79
- "required": [
80
- "name",
81
- "active"
82
- ]
1
+ {
2
+ "type": "object",
3
+ "x-documentConfig": {
4
+ "methods": [
5
+ "get",
6
+ "getList",
7
+ "post",
8
+ "patch"
9
+ ],
10
+ "documentName": "User"
11
+ },
12
+ "properties": {
13
+ "_id": {
14
+ "type": "string",
15
+ "x-format": "ObjectId",
16
+ "index": true
17
+ },
18
+ "authProfiles": {
19
+ "type": "array",
20
+ "items": {
21
+ "type": "object",
22
+ "properties": {
23
+ "provider": {
24
+ "type": "string",
25
+ "index": true
26
+ },
27
+ "authId": {
28
+ "type": "string",
29
+ "index": true
30
+ },
31
+ "username": {
32
+ "type": "string"
33
+ },
34
+ "password": {
35
+ "type": "string"
36
+ }
37
+ },
38
+ "required": []
39
+ }
40
+ },
41
+ "email": {
42
+ "type": "string",
43
+ "format": "email",
44
+ "index": true
45
+ },
46
+ "name": {
47
+ "type": "string",
48
+ "maxLength": 64,
49
+ "required": true
50
+ },
51
+ "active": {
52
+ "type": "boolean",
53
+ "default": true,
54
+ "required": true
55
+ },
56
+ "locale": {
57
+ "type": "string",
58
+ "maxLength": 8
59
+ },
60
+ "roles": {
61
+ "type": "array",
62
+ "x-vexData": "role",
63
+ "items": {
64
+ "type": "string",
65
+ "enum": [
66
+ "visitor",
67
+ "member",
68
+ "admin"
69
+ ]
70
+ },
71
+ "default": [
72
+ "visitor"
73
+ ]
74
+ },
75
+ "profileErrors": {
76
+ "type": "array",
77
+ "items": {
78
+ "type": "string"
79
+ }
80
+ }
81
+ },
82
+ "required": [
83
+ "name",
84
+ "active"
85
+ ]
83
86
  }
@@ -1,8 +1,8 @@
1
-
2
- pre {
3
- background-color: #f4f4f4;
4
- padding: 20px;
5
- overflow: auto;
6
- border: 1px solid #ccc;
7
- white-space: pre-wrap;
1
+
2
+ pre {
3
+ background-color: #f4f4f4;
4
+ padding: 20px;
5
+ overflow: auto;
6
+ border: 1px solid #ccc;
7
+ white-space: pre-wrap;
8
8
  }
@@ -1,19 +1,19 @@
1
-
2
- document.addEventListener("DOMContentLoaded", function() {
3
- console.log('Exchange Tokens from /auth/token');
4
- let sessionCode = new URLSearchParams(location.search).get('code');
5
- fetch(
6
- '/auth/token?code=' + sessionCode, {
7
- method: 'POST'
8
- }
9
- )
10
- .then((res) => res.text())
11
- .then((data) => {
12
- const jsonData = JSON.parse(data);
13
- document.querySelector("#tokenData").innerHTML = JSON.stringify(jsonData, null, 2);
14
- localStorage.setItem('accessToken', jsonData.result.accessToken);
15
- localStorage.setItem('accessTokenIndex', jsonData.result.accessTokenIndex);
16
- localStorage.setItem('refreshToken', jsonData.result.refreshToken);
17
- localStorage.setItem('refreshTokenIndex', jsonData.result.refreshTokenIndex);
18
- });
1
+
2
+ document.addEventListener("DOMContentLoaded", function() {
3
+ console.log('Exchange Tokens from /auth/token');
4
+ let sessionCode = new URLSearchParams(location.search).get('code');
5
+ fetch(
6
+ '/auth/token?code=' + sessionCode, {
7
+ method: 'POST'
8
+ }
9
+ )
10
+ .then((res) => res.text())
11
+ .then((data) => {
12
+ const jsonData = JSON.parse(data);
13
+ document.querySelector("#tokenData").innerHTML = JSON.stringify(jsonData, null, 2);
14
+ localStorage.setItem('accessToken', jsonData.result.accessToken);
15
+ localStorage.setItem('accessTokenIndex', jsonData.result.accessTokenIndex);
16
+ localStorage.setItem('refreshToken', jsonData.result.refreshToken);
17
+ localStorage.setItem('refreshTokenIndex', jsonData.result.refreshTokenIndex);
18
+ });
19
19
  });
@@ -1,11 +1,11 @@
1
- let jsonData = {};
2
-
3
- document.addEventListener("DOMContentLoaded", function () {
4
- jsonData = {
5
- accessToken: localStorage.getItem("accessToken"),
6
- accessTokenIndex: localStorage.getItem("accessTokenIndex"),
7
- refreshToken: localStorage.getItem("refreshToken"),
8
- refreshTokenIndex: localStorage.getItem("refreshTokenIndex"),
9
- };
10
- document.querySelector("#tokenData").innerHTML = JSON.stringify(jsonData, null, 2);
1
+ let jsonData = {};
2
+
3
+ document.addEventListener("DOMContentLoaded", function () {
4
+ jsonData = {
5
+ accessToken: localStorage.getItem("accessToken"),
6
+ accessTokenIndex: localStorage.getItem("accessTokenIndex"),
7
+ refreshToken: localStorage.getItem("refreshToken"),
8
+ refreshTokenIndex: localStorage.getItem("refreshTokenIndex"),
9
+ };
10
+ document.querySelector("#tokenData").innerHTML = JSON.stringify(jsonData, null, 2);
11
11
  });
@@ -1,23 +1,23 @@
1
- document.addEventListener("DOMContentLoaded", function () {
2
- jsonPayload = {
3
- refreshToken: localStorage.getItem("refreshToken"),
4
- refreshTokenIndex: localStorage.getItem("refreshTokenIndex"),
5
- };
6
-
7
- fetch("/auth/refresh", {
8
- method: "POST",
9
- body: JSON.stringify(jsonPayload),
10
- headers: {
11
- "Content-Type": "application/json",
12
- "Accept": "application/json",
13
- "Authorization": "Bearer " + localStorage.getItem("accessToken"),
14
- "X-Auth-Index": localStorage.getItem("accessTokenIndex")
15
- }
16
- })
17
- .then(res => res.json())
18
- .then((response) => {
19
- localStorage.setItem("accessToken", response.accessToken);
20
- localStorage.setItem("accessTokenIndex", response.accessTokenIndex);
21
- document.querySelector("#tokenData").innerHTML = JSON.stringify(response, null, 2);
22
- });
1
+ document.addEventListener("DOMContentLoaded", function () {
2
+ jsonPayload = {
3
+ refreshToken: localStorage.getItem("refreshToken"),
4
+ refreshTokenIndex: localStorage.getItem("refreshTokenIndex"),
5
+ };
6
+
7
+ fetch("/auth/refresh", {
8
+ method: "POST",
9
+ body: JSON.stringify(jsonPayload),
10
+ headers: {
11
+ "Content-Type": "application/json",
12
+ "Accept": "application/json",
13
+ "Authorization": "Bearer " + localStorage.getItem("accessToken"),
14
+ "X-Auth-Index": localStorage.getItem("accessTokenIndex")
15
+ }
16
+ })
17
+ .then(res => res.json())
18
+ .then((response) => {
19
+ localStorage.setItem("accessToken", response.accessToken);
20
+ localStorage.setItem("accessTokenIndex", response.accessTokenIndex);
21
+ document.querySelector("#tokenData").innerHTML = JSON.stringify(response, null, 2);
22
+ });
23
23
  });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes