Skip to content

Assistance Needed (Azure Static Web App, Authentication) #225

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

Open
eavestn opened this issue Feb 24, 2025 · 3 comments
Open

Assistance Needed (Azure Static Web App, Authentication) #225

eavestn opened this issue Feb 24, 2025 · 3 comments

Comments

@eavestn
Copy link

eavestn commented Feb 24, 2025

I've followed the steps outlined in the README for this project related to setting up a new Azure Authentication Registration, User Flow, etc; however, the output of that process is a staticwebapp.config.json file that needs to be associated with the Static Web App on build.

I have added it to the ./packages/webapp project root and it is being placed in the ./webapp/dist folder during azd deploy; however, the application itself cannot invoke the /.auth/login/aadb2c or other flow (it is returning a default, Azure-controller 404 page).

What I am seeing is that /.auth/me "works" (feel free to check it out) in that it returns:

{
  "clientPrincipal": null
}
  1. Where should this file be placed?
  2. Is the above-shown JSON response indicative of a my-side configuration issue?
@eavestn eavestn closed this as completed Feb 24, 2025
@eavestn eavestn reopened this Feb 24, 2025
@eavestn
Copy link
Author

eavestn commented Feb 25, 2025

I believe given the azd deploy mechanism for pushing this infrastructure into the cloud, it is nearly impossible to associate the correct staticwebapp.config.json with the needed Azure Static Web App (webapp) resource. I've tried modifying the npm build scripts to move the file into the /dist/ but that appears not to work.

@sinedied
Copy link
Contributor

You need to put the staticwebapp.config.json file in the webapp/public so that it's automatically copied when building/deploying the app.

You can also have a look a this other sample, which already enable SWA built-in authentication: https://github.com/Azure-Samples/openai-secure-ui-js

@eavestn
Copy link
Author

eavestn commented Feb 25, 2025

@sinedied there should also be the ability to enable Azure AD B2C authentication .auth/login/aadb2c which is not enabled out-of-box. Trying to figure out on my end how to get it functional. I'll see where I get; but worry I may need to abandon the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants