Merged in fix/sw-2563-pass-lang-to-sas-auth (pull request #1938)
Set ui_locales on SAS auth link * Set ui_locales on SAS auth link Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -15,6 +15,7 @@ import { getIntl } from "@/i18n"
|
||||
import { SASModal } from "../components/SASModal"
|
||||
|
||||
import type { LangParams, PageArgs, SearchParams } from "@/types/params"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { State } from "../sasUtils"
|
||||
|
||||
const searchParamsSchema = z.object({
|
||||
@@ -47,7 +48,7 @@ export default async function SASxScandicLoginPage({
|
||||
const audience = "eb-partner-api"
|
||||
const scope = encodeURIComponent("openid profile email")
|
||||
|
||||
const loginLink = `${sasLoginHostname}/oauth/authorize?response_type=code&client_id=${clientId}&redirect_uri=${redirectUri}&scope=${scope}&state=${urlState}&audience=${audience}`
|
||||
const loginLink = `${sasLoginHostname}/oauth/authorize?response_type=code&client_id=${clientId}&redirect_uri=${redirectUri}&scope=${scope}&state=${urlState}&audience=${audience}&ui_locales=${SAS_LANGUAGE_MAP[params.lang]}`
|
||||
|
||||
const intentDescriptions: Record<Intent, string> = {
|
||||
link: intl.formatMessage({
|
||||
@@ -110,3 +111,12 @@ export default async function SASxScandicLoginPage({
|
||||
</SASModal>
|
||||
)
|
||||
}
|
||||
|
||||
const SAS_LANGUAGE_MAP: Record<Lang, string> = {
|
||||
no: "nb",
|
||||
sv: "sv",
|
||||
fi: "fi",
|
||||
da: "da",
|
||||
en: "en",
|
||||
de: "de",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user