FriendlyCaptcha / friendly-challenge

The widget and docs for the proof of work challenge used in Friendly Captcha. Protect your websites and online services from spam and abuse with Friendly Captcha, a privacy-first anti-bot solution.
https://friendlycaptcha.com
MIT License
414 stars 61 forks source link

Widget verification failed under special conditions #170

Closed 0nePushMan closed 1 year ago

0nePushMan commented 1 year ago

Hello, I haven't found anything on the internet so I'm opening a github issue. I get this error on Windows 11 with chrome and firefox browsers but not edge. I also get this error with MacOS Ventura 13.0.1 on the firefox browser. The node version is 16.16.0 and the next version is 12.2.5.

I am currently trying to use friendly captcha on a project in next. I have used the documentation (see doc) to integrate the widget into a component. I have created a provider that adds the component to all pages of the project in the _app.js.

When the page is loaded, the widget loads but quickly displays Verification failed, Failed to connect to https://api.friendlycaptcha.com/api/v1/puzzle When I reload the page with a simple ctrl + r I get the same error, however when I reload the page with ctrl + shift + r the widget works and displays me "I am human".

ctrl + r

Screenshot 2022-12-05 at 17-41-24 Connexion Legapass

ctrl + shift + r

Screenshot 2022-12-05 at 17-42-41 Connexion Legapass

It seems that these are CSP errors according to the console. However, I did specify in the CSP of next.config.js the address https://api.friendlycaptcha.com/. I am attaching the console errors to this issue.

Console Error

merlinfuchs commented 1 year ago

This looks like a Content-Security-Policy issue. Please check if your Content-Security-Policy allows loading inline scripts. Sadly some browsers handle CSP slidely differently.

gzuidhof commented 1 year ago

I'm going to close this for now, let me know if we can help you further or if it has been resolved since. Happy to re-open

0nePushMan commented 1 year ago

Hi, sorry I haven't come back to give you news on this issue. It seems that the problem comes from next-pwa, if we remove it from the project, we don't have this problem anymore.