-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
MsalProvider gives Content Security Policy directive: "script-src 'self'" error #3396
Comments
@rvaitkus23 Can you please confirm that you have deployed a production build (as opposed to development build) of your app? That is the only thing that comes to mind as to why you would get this error. |
@jasonnutter yes. The process of deployment is to make a build, move it to the Nginx docker and serve as static files. Using Ejected CRA. React version Does that make a difference? |
@rvaitkus23 The MSAL React library does not use |
@rvaitkus23 Thanks for sharing. It looks like this is being triggered by regenerator-runtime. Please see this issue for a potential work around. @AndrewCraswell Did you end up figuring out how to disable strict mode with CRA? cc @tnorling |
Thank you @jasonnutter . the issue is triggered in regenerator-runtime. However, the described workaround does not look acceptable. For now, I am implementing my own simple wrapper and will not use '@azure/msal-browser' till it will be solved. |
Out of curiosity, did you try the workaround, it worked, but not find it acceptable from a code perspective, or did the workaround not fix the issue? |
I don't have much knowledge about regenerator-runtime. I gave a couple of shots adding |
@rvaitkus23 I see, thanks. We'll put this in the backlog to investigate to see if there is anything we can do in the library to mitigate this issue. cc: @tnorling |
Core Library
@azure/msal-browser
Core Library Version
2.12.1
Wrapper Library
@azure/msal-react
Wrapper Library Version
1.0.0-beta.1
Description
When I add
<MsalProvider instance={msalInstance}>
I get a "Content Security Policy" error and my app is not loading anymore.Locally it works fine, but after build and serve it on the Nginx docker container in Azure infrastructure I get this error. If I remove this context initialization the app starts to load again.
Error Message
runtime.js:747 Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
Msal Logs
The app is crashing before it is even loaded
MSAL Configuration
Relevant Code Snippets
Reproduction Steps
<MsalProvider instance={msalInstance}>
as shown in examples and the app is not loadingExpected Behavior
It should not crash an app
Identity Provider
Azure B2C Custom Policy
Browsers Affected (Select all that apply)
Chrome, Safari
Regression
No response
Source
External (Customer)
The text was updated successfully, but these errors were encountered: