Comments (17)
Looks like it's hanging on the line:
await metamask.request({
method: 'eth_requestAccounts',
});
from siwe.
@jaerith sorry to hear that it's not working smoothly for you! Do any other apps using MetaMask work for you? You can try this one: https://web3modal.com/
We use web3modal under the hood.
Correction: we donβt use web3modal for the notepad example, only login.xyz
from siwe.
Interesting...I'm able to sign into the web3modal site without any issue.
from siwe.
I'm experiencing this too, running Firefox v94 on Ubuntu. Metamask works fine on the web3modal site. This error message gets logged in the console:
Uncaught (in promise) TypeError: metamask is undefined
signIn providers.ts:35
__awaiter bundle.js:95800
__awaiter bundle.js:95796
signIn providers.ts:28
ts providers.ts:176
Update: window.ethereum
in console is undefined in SIWE-notepad, not undefined in web3modal
Update 2: Missed this earlier, actually this error message is the first error in the console Content Security Policy: The page's settings blocked the loading of a resource at inline ("script-src")
from siwe.
@jaerith @dcato98 Do you have any other wallets installed?
from siwe.
No, only metamask. See update 2 in my previous message though, I missed an earlier error in the console.
from siwe.
I've never dealt with CSP before, but a quick google suggested adding this line to the head tag in index.html might fix the problem alas it does not.
<meta http-equiv="Content-Security-Policy" content="script-src 'self';" />
from siwe.
I'll dig into it a little further, but for this specific setup it wouldn't work, we have to set the CSP at Helmet
. Does metamask work here?
from siwe.
Still no luck. Here's a full screenshot of the console errors.
from siwe.
Huh...apparently I get 5 of these CSP error messages even here on github, so maybe this is an extension blocking stuff? On the right of the errors it says 'moz-extension'.
Update: Allowed only the metamask extension in a private window and got the same behavior, although this time I'm only seeing one CSP error instead of 4.
from siwe.
This is related to this open issue.
from siwe.
From the commentary in the issue you linked above, the easy-but-unsatisfying fix is to omit the Content Security Policy.
I tested this out and indeed, after commenting out the CSP in index.ts (i.e. app.use(Helmet(...))
), metamask now works as expected.
For those looking for a fix that doesn't reduce security, there were a few slightly more complicated suggestions in the issue mentioned in the previous post for working around this.
from siwe.
Confirmed! Thanks @dcato98, commenting out the usage of Helmet got it to work.
The million dollar question is this: how does this Notepad example differ from the online voting demo when it comes to CSP, since that one does work in Mozilla?
from siwe.
The issue occurs only when CSP is applied to headers, since the content from the Notepad example is served directly from the express application Helmet
filter those, that's not the case for login.xyz the API is quite similar but the files are not served from the API.
from siwe.
Thanks for the answer, @w4ll3! So we should avoid using Firefox for the time being and use another browser instead, like Chrome?
from siwe.
You could do that, or remove Helmet.
from siwe.
Thanks again!
from siwe.
Related Issues (20)
- Is there a cdn release? Want to try siwe with Flutter Web HOT 2
- Can't resolve `net` error with SiweMessage HOT 2
- Using siwe message giving me error "Buffer is not defined" HOT 2
- ncaught Error: No QueryClient set, use QueryClientProvider to set one
- TypeError: (0 , siwe_parser_1.isEIP55Address) is not a function HOT 1
- Cannot read property 'SiweMessage' of undefined HOT 2
- Invalid signature recovery are logged via console.error, breaking applications with custom logging flow
- Viem support? HOT 13
- isEIP55Address cannot be called because @spruceid/siwe-parser might be below 2.0.0 version HOT 3
- Suggestion regarding siwe-parser usage of apg-js. HOT 9
- Please provide CDN HOT 1
- Change Provider configuration to allow plain RPC URL property
- Cannot sign in with Argent wallet HOT 1
- Custom logo when authenticating, possible? HOT 4
- Crash on iOS 14 When Initializing SiweMessage Instance HOT 5
- I'm not getting the right address when checking HOT 3
- '"ethers"' has no exported member named 'providers' HOT 1
- Why version "2.1.4", requires SiweMessage.version to be 1? HOT 1
- Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (2:0) HOT 1
- Cloudflare Workers compatibility HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from siwe.