You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, been getting an issue with the adapter when decoding the x-ms-client-principal.
I have a B2C tenant where we have a custom attribute called PlayerName (string). I have a SvelteKit app running on Azure's Static Web Apps consuming the x-ms-client-principal. This field accepts pretty much any character but for our purposes we'd like to allow kanji characters like 漢字 .
When Sveltekit parses the header, I get this exception:
Exception while executing function: Functions.sk_render Result: Failure Exception: Unexpected token � in JSON at position 93 Stack: SyntaxError: Unexpected token � in JSON at position 93 at JSON.parse (<anonymous>) at getClientPrincipalFromHeaders (/home/site/wwwroot/sk_render/index.js:117420:32) at Object.index23 (/home/site/wwwroot/sk_render/index.js:117435:27) at t.InvocationModel.<anonymous> (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:59683) at Generator.next (<anonymous>) at /azure-functions-host/workers/node/dist/src/worker-bundle.js:2:58008 at new Promise (<anonymous>) at h (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:57753) at t.InvocationModel.invokeFunction (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:59490) at m.<anonymous> (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:37872)
However I think this is incorrect because the client principal is basically a JWT encoded which I think are encoded UTF-8. I think the Microsoft documentation is incorrect.
Hi, been getting an issue with the adapter when decoding the
x-ms-client-principal
.I have a B2C tenant where we have a custom attribute called PlayerName (string). I have a SvelteKit app running on Azure's Static Web Apps consuming the
x-ms-client-principal
. This field accepts pretty much any character but for our purposes we'd like to allow kanji characters like 漢字 .When Sveltekit parses the header, I get this exception:
I believe the error happens here: https://github.com/geoffrich/svelte-adapter-azure-swa/blob/main/files/headers.js#L59
Which the Microsoft documentation says the same thing: https://learn.microsoft.com/en-us/azure/static-web-apps/user-information?tabs=javascript#api-functions
However I think this is incorrect because the client principal is basically a JWT encoded which I think are encoded UTF-8. I think the Microsoft documentation is incorrect.
I wanted to get a confirmation from them before sending in an issue but nothing from them so far. https://learn.microsoft.com/en-us/answers/questions/1375113/azure-b2c-client-principal-encoding-documentation?page=1&orderby=helpful&comment=answer-1323081
Reproduction steps:
I still have this setup so I can maybe do some testing.
The text was updated successfully, but these errors were encountered: