spruceid / discourse-siwe-auth

Discourse plugin for SIWE authentication
Other
34 stars 13 forks source link

Server error for `message` #8

Closed communiteq closed 2 years ago

communiteq commented 2 years ago

During the authentication process, a callback is made to /discourse-siwe/message resulting in a 500 server error. This happens before pressing the button "sign-in with Ethereum".

The request does not have any parameters so that is why the error occurs. After pressing the "sign in" button a successful request is made to /discourse-siwe/message with eth_account and chain_id parameters.

The logs say

Siwe::InvalidAddress (Address does not conform to EIP-55 or is invalid.) app/controllers/application_controller.rb:397:in `block in with_resolved_locale' app/controllers/application_controller.rb:397: 
siwe (1.1.2) lib/siwe/message.rb:82:in `rescue in initialize'
siwe (1.1.2) lib/siwe/message.rb:79:in `initialize'
plugins/discourse-siwe-auth/app/controllers/discourse_siwe/auth_controller.rb:13:in `new'
plugins/discourse-siwe-auth/app/controllers/discourse_siwe/auth_controller.rb:13:in `message'
w4ll3 commented 2 years ago

You actually doesn't have to click the button to start the process, it should automatically start, the button is there just in case the someone rejects the signature it can re-start. It seems that it's proceeding even in case of signature request failure (User rejection in this case).