lively-scientist-17848
05/23/2023, 11:29 AMlimited-photographer-61008
05/23/2023, 12:26 PMlimited-photographer-61008
05/23/2023, 12:28 PMlively-scientist-17848
05/23/2023, 12:29 PMlively-scientist-17848
05/23/2023, 12:30 PMlively-scientist-17848
05/23/2023, 2:07 PMconst getOrySessionToken = async (): Promise<string> => {
const frontendApi = new ory.FrontendApi(
new ory.Configuration({
basePath: "<https://project.console.ory.sh>",
})
)
const { ORY_USER_NAME, ORY_PASSWORD } = process.env
if (!ORY_USER_NAME || !ORY_PASSWORD) {
throw new Error("ORY_USER_NAME or ORY_PASSWORD are not defined")
}
const loginResult = await frontendApi.createNativeLoginFlow().then(
flow => frontendApi.updateLoginFlow({
flow: flow.data.id,
updateLoginFlowBody: {
identifier: ORY_USER_NAME,
password: ORY_PASSWORD,
method: 'password',
}
})
)
return loginResult.data.session_token as string
}fast-lunch-54279
fast-lunch-54279
fast-lunch-54279
lively-scientist-17848
05/24/2023, 4:48 PMlively-scientist-17848
05/24/2023, 4:49 PMlively-scientist-17848
05/24/2023, 4:50 PMlively-scientist-17848
05/24/2023, 4:51 PMlively-scientist-17848
05/24/2023, 4:51 PMfast-lunch-54279
fast-lunch-54279
magnificent-energy-493