-
Here is the code for deploying a contract which was working fine before enabling JWT token on
But the deploy above throws error
And added
However it throws similar error again about "eth_getTransactionCount". It seems that provider is not aware that it needs to submit the JWT token along with request to network.
I thought by adding JWT headers in provider (and wallet thereafter) will automatically enable each and every ethers call to network with JWT token needed for authentication. And it is obviously not the case. Is there something I missed here about authentication headers so it didn't work? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 2 replies
-
It should use them for every request. What happens if you manually request the transaction count, balance, etc. with the |
Beta Was this translation helpful? Give feedback.
-
Hi
The error is same status=401:
The JWT token authentication is not working! |
Beta Was this translation helpful? Give feedback.
-
Does the same request work with curl? Perhaps the token is incorrect? |
Beta Was this translation helpful? Give feedback.
-
It looks like you are using the JWT specification incorrectly? I haven’t personally used it, but it looks like you need to specify it as the |
Beta Was this translation helpful? Give feedback.
-
The eth_getBlockNumber works with curl. The network is Besu which uses public key to verify a JWT token. Here is the curl command
|
Beta Was this translation helpful? Give feedback.
-
Or shall the connection is defined as:
|
Beta Was this translation helpful? Give feedback.
-
Yes. Ethers doesn’t have built in parsing for JWT. You probably want: {
Authorization: `Bearer ${ tokenBesu }`
} |
Beta Was this translation helpful? Give feedback.
-
(moving to discussions so future people can find this answer too ;)) |
Beta Was this translation helpful? Give feedback.
Yes. Ethers doesn’t have built in parsing for JWT. You probably want: