strapi-custom-auth 1.2.28 → 1.2.30
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.
- package/dist/server/index.js +4 -19
- package/dist/server/index.mjs +4 -19
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -3391,8 +3391,7 @@ async function microsoftLogout(ctx) {
|
|
|
3391
3391
|
}
|
|
3392
3392
|
async function microsoftTokenRenewal(ctx) {
|
|
3393
3393
|
const userService = strapi.service("admin::user");
|
|
3394
|
-
|
|
3395
|
-
const tokenService2 = strapi.service("admin.token");
|
|
3394
|
+
strapi.service("admin::token");
|
|
3396
3395
|
const config2 = configValidation();
|
|
3397
3396
|
const { body } = ctx.request;
|
|
3398
3397
|
const params = new URLSearchParams();
|
|
@@ -3417,23 +3416,9 @@ async function microsoftTokenRenewal(ctx) {
|
|
|
3417
3416
|
});
|
|
3418
3417
|
const { mail } = userResponse?.data;
|
|
3419
3418
|
const dbUser = await userService.findOneByEmail(mail);
|
|
3420
|
-
const jwtToken =
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
console.log("----tokenService2----", tokenService2);
|
|
3424
|
-
console.log("----tokenService2----", JSON.stringify(tokenService2));
|
|
3425
|
-
try {
|
|
3426
|
-
const jwtToken2 = await tokenService2.createJwtToken(dbUser);
|
|
3427
|
-
console.log("----jwtToken2----", jwtToken2);
|
|
3428
|
-
} catch (e2) {
|
|
3429
|
-
console.log("----jwtToken2----, e", JSON.stringify(e2));
|
|
3430
|
-
}
|
|
3431
|
-
try {
|
|
3432
|
-
const jwtToken3 = await tokenService2.createToken(dbUser);
|
|
3433
|
-
console.log("----jwtToken3----", jwtToken3);
|
|
3434
|
-
} catch (e2) {
|
|
3435
|
-
console.log("----jwtToken3----, e", JSON.stringify(e2));
|
|
3436
|
-
}
|
|
3419
|
+
const jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3420
|
+
id: dbUser.id
|
|
3421
|
+
});
|
|
3437
3422
|
return ctx.send({ accessToken: jwtToken, refreshToken: tokenResponse.data.refresh_token });
|
|
3438
3423
|
} catch (e2) {
|
|
3439
3424
|
console.error(e2.message);
|
package/dist/server/index.mjs
CHANGED
|
@@ -3376,8 +3376,7 @@ async function microsoftLogout(ctx) {
|
|
|
3376
3376
|
}
|
|
3377
3377
|
async function microsoftTokenRenewal(ctx) {
|
|
3378
3378
|
const userService = strapi.service("admin::user");
|
|
3379
|
-
|
|
3380
|
-
const tokenService2 = strapi.service("admin.token");
|
|
3379
|
+
strapi.service("admin::token");
|
|
3381
3380
|
const config2 = configValidation();
|
|
3382
3381
|
const { body } = ctx.request;
|
|
3383
3382
|
const params = new URLSearchParams();
|
|
@@ -3402,23 +3401,9 @@ async function microsoftTokenRenewal(ctx) {
|
|
|
3402
3401
|
});
|
|
3403
3402
|
const { mail } = userResponse?.data;
|
|
3404
3403
|
const dbUser = await userService.findOneByEmail(mail);
|
|
3405
|
-
const jwtToken =
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
console.log("----tokenService2----", tokenService2);
|
|
3409
|
-
console.log("----tokenService2----", JSON.stringify(tokenService2));
|
|
3410
|
-
try {
|
|
3411
|
-
const jwtToken2 = await tokenService2.createJwtToken(dbUser);
|
|
3412
|
-
console.log("----jwtToken2----", jwtToken2);
|
|
3413
|
-
} catch (e2) {
|
|
3414
|
-
console.log("----jwtToken2----, e", JSON.stringify(e2));
|
|
3415
|
-
}
|
|
3416
|
-
try {
|
|
3417
|
-
const jwtToken3 = await tokenService2.createToken(dbUser);
|
|
3418
|
-
console.log("----jwtToken3----", jwtToken3);
|
|
3419
|
-
} catch (e2) {
|
|
3420
|
-
console.log("----jwtToken3----, e", JSON.stringify(e2));
|
|
3421
|
-
}
|
|
3404
|
+
const jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3405
|
+
id: dbUser.id
|
|
3406
|
+
});
|
|
3422
3407
|
return ctx.send({ accessToken: jwtToken, refreshToken: tokenResponse.data.refresh_token });
|
|
3423
3408
|
} catch (e2) {
|
|
3424
3409
|
console.error(e2.message);
|
package/package.json
CHANGED