'Azure Static Web Apps - AAD Authentication via a honkit app
I am having difficulty implementing azure's out-of-the-box AAD feature in my static web app. as per documentation, my login links redirect to github, AAD and twitter.
My issue is that unless I specify the authentication links to open in a new tab, opening the link will throw the following CORS error.
has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
Opening the authentication hyperlinks in new tabs works flawlessly (I suspect because a new tab is a new session) but I'm struggling to make sense of it and to find a workaround.
Some additional details if they're of any help:
the app is a Honkit (Gitbook) website
the routing policies I use in my staticwebapp.config.json are as follows:
"globalHeaders": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "HEAD, GET, POST, PUT, PATCH, DELETE, OPTIONS"
},
"routes": [
{
"route": "/login-aad",
"redirect": ".auth/login/aad"
},
{
"route": "/login-github",
"redirect": ".auth/login/github"
},
{
"route": "/login-twitter",
"redirect": ".auth/login/twitter"
}
]
}
I sincerely hope the community can help me, thanks a million!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|