-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/auth/.../callback does not work in Azure static web app | Custom prefix for callback handlers #56
Comments
Hey,
Also keep in mind, B2C is not formally OIDC compliant, only Entra External ID is (which is basically the successor of B2C, as B2C is not in active development anymore afaik). I will try to reproduce as best as I can as soon as you shared your configs! |
Hey, thanks for the quick reply! Answers:
{
"routes": [
{
"route": "/index.html",
"redirect": "/"
},
{
"route": "/",
"rewrite": "/api/server"
}
],
"platform": {
"apiRuntime": "node:18"
},
"navigationFallback": {
"rewrite": "/api/server"
}
} I tried to use built-in rewrite there, but it still ended up with 405.
Setup to reproduce:
This is a part of nuxt config {
oidc: {
providers: {
entra: {
redirectUri: "http://localhost:3000/auth/entra/callback",
clientId: "<app client id>",
clientSecret: "",
audience: "<app client id>",
authorizationUrl: "<Azure AD B2C OAuth 2.0 authorization endpoint (v2)>",
tokenUrl: "<Azure AD B2C OAuth 2.0 token endpoint (v2)>",
logoutUrl: "<Azure AD B2C OAuth 2.0 logout endpoint (v2)>",
logoutRedirectUri: "http://localhost:3000",
userNameClaim: "name",
nonce: true,
responseType: "code id_token",
scope: [ "openid" ],
validateIdToken: true,
exposeIdToken: true,
validateAccessToken: true,
exposeAccessToken: true,
responseMode: "form_post",
},
},
middleware: {
globalMiddlewareEnabled: false,
customLoginPage: false,
},
devtools: true,
},
nitro: {
preset: "azure",
storage: {
oidc: {
driver: "fs",
base: ".data/storage/oidc",
},
},
},
} You don't have to deploy it to azure. |
I don't have a B2C tenant available currently, I just know that B2C is officially not OIDC compliant. For SWA, I know that Entra External ID offers what you mentioned, meaning local accounts plus external social accounts login and would be the better choice as the default swa model with the proxy in the middle is not really made for ssr based auth. |
Hi,
I'm building a nuxt app with Azure B2C as entra provider and deploying it to Azure Static Web Apps.
The nuxt app itself works fine. But I have an issue after successful sign-in and in the callback handler.
Namely,
POST /auth/entra/callback
does not go through to the backend.There are several constraints when API backend is used in static apps and one of them:
Therefore
405 method not allowed
is shown after redirect.What I get working is a custom handler /api/auth/[...].ts:
Having a custom handler is ok. But importing the functions from the library is not best.
I also used
proxyRequest
in that handler but then it returns502 Bad Gateway
.I have it working with the workaround above.
But maybe you know other solutions here?
Or the library can be extended to have a custom prefix for (callback) handler?
The text was updated successfully, but these errors were encountered: