Skip to content

Commit cccd9f0

Browse files
hperlory-bot
authored andcommitted
fix: routes in AX with identity_schema
GitOrigin-RevId: ab72dc64c194c06bf0301e87aa829c72022ac41e
1 parent 9cdb341 commit cccd9f0

File tree

5 files changed

+142
-59
lines changed

5 files changed

+142
-59
lines changed

.reports/dep-licenses.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"module name","licenses"
2-
"@ory/[email protected].10","Apache-2.0"
2+
"@ory/[email protected].8","Apache-2.0"
33

package-lock.json

Lines changed: 116 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"views/*"
1919
],
2020
"scripts": {
21-
"build": "rm -rf lib/* && tsc",
21+
"build": "rm -rf lib/* && npx tsc",
2222
"serve": "node lib/index.js",
2323
"start": "nodemon",
2424
"test": "exit 0",
@@ -27,7 +27,7 @@
2727
},
2828
"prettier": "ory-prettier-styles",
2929
"dependencies": {
30-
"@ory/client": "1.21.0",
30+
"@ory/client": "1.21.5",
3131
"@ory/elements-markup": "0.8.0",
3232
"@redtea/format-axios-error": "2.1.1",
3333
"accept-language-parser": "1.5.0",
@@ -48,7 +48,7 @@
4848
"@types/axios": "0.14.0",
4949
"@types/body-parser": "1.19.2",
5050
"@types/cookie-parser": "1.4.3",
51-
"@types/express": "4.17.17",
51+
"@types/express": "4.17.21",
5252
"@types/express-handlebars": "6.0.2",
5353
"@types/handlebars-helpers": "0.5.3",
5454
"@types/jwt-decode": "3.1.0",

src/routes/login.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const createLoginRoute: RouteCreator =
2626
organization = "",
2727
via = "",
2828
login_challenge,
29+
identity_schema,
2930
} = req.query
3031
const { frontend, kratosBrowserUrl, logoUrl, extraPartials } =
3132
createHelpers(req, res)
@@ -42,6 +43,9 @@ export const createLoginRoute: RouteCreator =
4243
logger.debug("login_challenge found in URL query: ", { query: req.query })
4344
initFlowQuery.append("login_challenge", login_challenge)
4445
}
46+
if (isQuerySet(identity_schema)) {
47+
initFlowQuery.append("identity_schema", identity_schema)
48+
}
4549

4650
const initFlowUrl = getUrlForFlow(kratosBrowserUrl, "login", initFlowQuery)
4751

@@ -118,6 +122,9 @@ export const createLoginRoute: RouteCreator =
118122
(return_to && return_to.toString()) ||
119123
loginFlow.return_to ||
120124
"",
125+
...(loginFlow.identity_schema && {
126+
identity_schema: loginFlow.identity_schema,
127+
}),
121128
}),
122129
),
123130
),
@@ -139,13 +146,13 @@ export const createLoginRoute: RouteCreator =
139146
const initRegistrationQuery = new URLSearchParams({
140147
return_to:
141148
(return_to && return_to.toString()) || flow.return_to || "",
149+
...(flow.identity_schema && {
150+
identity_schema: flow.identity_schema.toString(),
151+
}),
152+
...(flow.oauth2_login_request?.challenge && {
153+
login_challenge: flow.oauth2_login_request.challenge,
154+
}),
142155
})
143-
if (flow.oauth2_login_request?.challenge) {
144-
initRegistrationQuery.set(
145-
"login_challenge",
146-
flow.oauth2_login_request.challenge,
147-
)
148-
}
149156

150157
let initRecoveryUrl = ""
151158
const initRegistrationUrl = getUrlForFlow(

0 commit comments

Comments
 (0)