@kwirthmagnify/kwirth-common-back 0.5.17 → 0.5.18

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.
@@ -25,6 +25,7 @@ export interface IIdpCallbackContext {
25
25
  code: string;
26
26
  codeVerifier: string;
27
27
  redirectUri: string;
28
+ params?: Record<string, string>;
28
29
  }
29
30
  export interface IIdpConnector {
30
31
  connectorId: string;
package/dist/oidc.js CHANGED
@@ -46,7 +46,13 @@ async function oidcBuildAuthorizationUrl(config, ctx, defaultIssuer) {
46
46
  }
47
47
  async function oidcHandleCallback(config, ctx, defaultIssuer) {
48
48
  const client = await makeClient(config, ctx.redirectUri, defaultIssuer);
49
- const tokenSet = await client.callback(ctx.redirectUri, { code: ctx.code }, { code_verifier: ctx.codeVerifier });
49
+ // pasamos los params crudos del callback (incluyen iss para RFC 9207 y state); el state ya lo
50
+ // valida el core, pero openid-client exige checks.state si el param state viene presente.
51
+ const params = ctx.params ?? { code: ctx.code };
52
+ const checks = { code_verifier: ctx.codeVerifier };
53
+ if (params.state !== undefined)
54
+ checks.state = params.state;
55
+ const tokenSet = await client.callback(ctx.redirectUri, params, checks);
50
56
  const claims = tokenSet.claims();
51
57
  return {
52
58
  email: String(claims.email ?? ''),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwirthmagnify/kwirth-common-back",
3
- "version": "0.5.17",
3
+ "version": "0.5.18",
4
4
  "description": "Backend interfaces for building Kwirth provider and channel plugins",
5
5
  "scripts": {
6
6
  "build": "tsc"