oddsdk / walletauth

walletauth.vercel.app
7 stars 1 forks source link

"Failed to create fission user" error #3

Open jeffgca opened 2 years ago

jeffgca commented 2 years ago

If I try to connect to the walletauth demo with metamask, I get an error: "Failed to create Fission user"

Error: Failed to create Fission user
    pn Immutable
session-a06b67b3.js:2:4433
    Ei Immutable
jeffgca commented 2 years ago

This error is actually produced in the walletauth dependency:

https://github.com/fission-codes/webnative-walletauth/blob/ee622b814ad5c02831e295d8b86cb1a329b36f22/src/index.ts#L97

jeffgca commented 2 years ago

This is another error from the console that I think is related to this problem

Signature does not match content

XHR PUT https://runfission.net/v2/api/user
[HTTP/2 422 Unprocessable Entity 779ms]

PUT
    https://runfission.net/v2/api/user
Status
422
Unprocessable Entity
VersionHTTP/2
Transferred177 B (32 B size)
Referrer Policystrict-origin-when-cross-origin

    access-control-allow-origin
        *
    date
        Tue, 13 Sep 2022 13:26:47 GMT
    server
        Warp/3.3.20
    X-Firefox-Spdy
        h2

    Accept
        */*
    Accept-Encoding
        gzip, deflate, br
    Accept-Language
        en-US,en;q=0.5
    authorization
        Bearer eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QiLCJ1YXYiOiIxLjAuMCJ9.eyJhdWQiOiJkaWQ6a2V5OnpTdEVacHpTTXRUdDlrMnZzemd2Q3dGNGZMUVFTeUExNVc1QVE0ejNBUjZCeDRlRko1Y3JKRmJ1R3hLbWJtYTQiLCJleHAiOjE2NjMwNzU2OTUsImZjdCI6W10sImlzcyI6ImRpZDprZXk6ejdyOG9zYkhpcEJ2WlNWTTZiaEoxTlRYN3hZYUQ4a3BFd1JzdEh4U1dBdHZ0bVJoRjI3RTZjWmRraTdQZWhZMlE3bWd2elVQU3c0OXc3QTc1R0F1ZTNYa2hBUXQ0IiwibmJmIjoxNjYzMDc1NTE1LCJwcmYiOm51bGwsInB0YyI6bnVsbCwicnNjIjoiKiJ9.7KeMTI-AGxGTDs4ToHNQk_8F3uBo211NMDPT7IVQQHlOfCxPD6dbgWWiI3I3RU2BDDM3tfDJJH-RzYmdsq7tfRs
    Cache-Control
        no-cache
    Connection
        keep-alive
    Content-Length
        57
    content-type
        application/json
    DNT
        1
    Host
        runfission.net
    Origin
        https://walletauth.fission.app
    Pragma
        no-cache
    Referer
        https://walletauth.fission.app/
    Sec-Fetch-Dest
        empty
    Sec-Fetch-Mode
        cors
    Sec-Fetch-Site
        cross-site
    TE
        trailers
    User-Agent
        Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0
jeffgca commented 2 years ago

The auth header:


Bearer eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QiLCJ1YXYiOiIxLjAuMCJ9.eyJhdWQiOiJkaWQ6a2V5OnpTdEVacHpTTXRUdDlrMnZzemd2Q3dGNGZMUVFTeUExNVc1QVE0ejNBUjZCeDRlRko1Y3JKRmJ1R3hLbWJtYTQiLCJleHAiOjE2NjMwNzkyNDIsImZjdCI6W10sImlzcyI6ImRpZDprZXk6ejdyOG9zYkhpcEJ2WlNWTTZiaEoxTlRYN3hZYUQ4a3BFd1JzdEh4U1dBdHZ0bVJoRjI3RTZjWmRraTdQZWhZMlE3bWd2elVQU3c0OXc3QTc1R0F1ZTNYa2hBUXQ0IiwibmJmIjoxNjYzMDc5MDYyLCJwcmYiOm51bGwsInB0YyI6bnVsbCwicnNjIjoiKiJ9.xc2OVs4owvx87Fpvg40jabotbapnEqs_lsaL_Q0slr0SViNl_jQTnmevf2c2RRaStLhK3RSrRof4IUeQ8Zcs9Bw
matheus23 commented 2 years ago

Ok, so I dissected the auth token from above, it essentially shows this:

{
  "aud": "did:key:zStEZpzSMtTt9k2vszgvCwF4fLQQSyA15W5AQ4z3AR6Bx4eFJ5crJFbuGxKmbma4",
  "exp": 1663079242,
  "fct": [],
  "iss": "did:key:z7r8osbHipBvZSVM6bhJ1NTX7xYaD8kpEwRstHxSWAtvtmRhF27E6cZdki7PehY2Q7mgvzUPSw49w7A75GAue3XkhAQt4",
  "nbf": 1663079062,
  "prf": null,
  "ptc": null,
  "rsc": "*"
}

When I do it on my machine, it generates this payload, which works:

{
  "aud": "did:key:zStEZpzSMtTt9k2vszgvCwF4fLQQSyA15W5AQ4z3AR6Bx4eFJ5crJFbuGxKmbma4",
  "exp": 1663080322,
  "fct": [],
  "iss": "did:key:z7r8oqxrrMaFRDtL1Co5JWiyrAQhd5YmhZbQU3T27sWEQXkpPBQUy83K9cALuU2n5NTjWi2ETRMkQZUFsECNBWoC2XirY",
  "nbf": 1663080142,
  "prf": null,
  "ptc": null,
  "rsc": "*"
}

This is the full token:

eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QiLCJ1YXYiOiIxLjAuMCJ9.eyJhdWQiOiJkaWQ6a2V5OnpTdEVacHpTTXRUdDlrMnZzemd2Q3dGNGZMUVFTeUExNVc1QVE0ejNBUjZCeDRlRko1Y3JKRmJ1R3hLbWJtYTQiLCJleHAiOjE2NjMwODAzMjIsImZjdCI6W10sImlzcyI6ImRpZDprZXk6ejdyOG9xeHJyTWFGUkR0TDFDbzVKV2l5ckFRaGQ1WW1oWmJRVTNUMjdzV0VRWGtwUEJRVXk4M0s5Y0FMdVUybjVOVGpXaTJFVFJNa1FaVUZzRUNOQldvQzJYaXJZIiwibmJmIjoxNjYzMDgwMTQyLCJwcmYiOm51bGwsInB0YyI6bnVsbCwicnNjIjoiKiJ9.30kN2ZiUDoVykJm8rEjFmzRVF_Qqw1p90NvY7RzCfRhfd74uRYi0IaGUkj4rX29v-370NDXQuUk3H3-QRv9ylhs

Maybe that helps debugging this.

jeffgca commented 2 years ago

Update: I can reliably get the demo working by creating a new account in MM. Given this lets us demo something to people this week, we can get to figuring out this issue with some wallet addresses not working with less urgency.

avivash commented 1 year ago

Another account that consistently fails:

{
  "Address": "0x838B700C4579C90F5d848b57391e9B7E7E0A1102",
  "Private key": "ca0bce2e14a4e493bf20c20b072ea0af72519d22e7f2e161385151367623e7af",
  "Token": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QiLCJ1YXYiOiIxLjAuMCJ9.eyJhdWQiOiJkaWQ6a2V5OnpTdEVacHpTTXRUdDlrMnZzemd2Q3dGNGZMUVFTeUExNVc1QVE0ejNBUjZCeDRlRko1Y3JKRmJ1R3hLbWJtYTQiLCJleHAiOjE2NjYyODY5NzYsImZjdCI6W10sImlzcyI6ImRpZDprZXk6ejdyOG9ycmlzbzN3OFJ0N0JaWmR5WmlSVHRidWhMRkRiVFNCZmQ4M0FBQ3RWMlg5b1FubnhQblFNc21FWVljRm5LSHd2bU4xeTVYUE5ITTYzdlJxdThuZGM5cXRGIiwibmJmIjoxNjY2Mjg2Nzk2LCJwcmYiOm51bGwsInB0YyI6bnVsbCwicnNjIjoiKiJ9.ohS5tFDw3smuq4pntjz0w5mHJ9_VH6jXCX8GK-NVdml6T6dCM5T0VDqQvgovXpkBnkEY4r-LTO5M3Ne8yHQNyRs"
}

Failing request:

image

Payload:

{ 
  "username": "0x838b700c4579c90f5d848b57391e9b7e7e0a1102" 
}

Response: Signature does not match content

I'm currently (poorly) navigating the fission repo to track down the exact cause of the error, but I may need to rope in someone who can efficiently read haskell because I certainly can't yet 🙈 maybe @bgins if you have some free cycles this week/sprint, would you be up for a quick(ish) pairing session?