rainbowkit icon indicating copy to clipboard operation
rainbowkit copied to clipboard

[bug] Custom Authentication adapter is not working

Open avp1598 opened this issue 3 years ago • 7 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

RainbowKit Version

0.5.0

wagmi Version

0.6.0

Current Behavior

I am using custom auth adapter following the steps mentioned here https://www.rainbowkit.com/docs/custom-authentication but when I verify the signature, if we return true from the verify function it is just stuck at this image

if I return false it notifies that there is an error, but for success case it is stuck. If i refresh it works.

Expected Behavior

Expected behavior is that the modal closes and I am logged in.

Steps To Reproduce

  1. yarn create rainbow-kit
  2. add custom authentication adapter

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

https://stackblitz.com/edit/next-typescript-by4kmo?file=pages/index.tsx

No response

Anything else?

No response

avp1598 avatar Aug 24 '22 09:08 avp1598

Same issue

KaladinStormBlessed16 avatar Aug 28 '22 12:08 KaladinStormBlessed16

@avp1598 The issue for me was that the state of AUTHENTICATION_STATUS wasn't changing after succesfully verifying the sign transaction. create a state variable loginStatus which changes after the verify step, and listen to that variable in the useEffect so you can check with your backend whether you are authenticated or not.

KaladinStormBlessed16 avatar Aug 28 '22 16:08 KaladinStormBlessed16

@KaladinStormBlessed16 how to update state variable in the authentication adapter? we can only update it in a react component right? can you share some example

avp1598 avatar Aug 31 '22 11:08 avp1598

@avp1598 I moved the authenticationAdapter inside of the component so I have access to state variables.

KaladinStormBlessed16 avatar Aug 31 '22 11:08 KaladinStormBlessed16

@KaladinStormBlessed16 thanks a lot works now! but the docs do need to be more clearer

avp1598 avatar Aug 31 '22 12:08 avp1598

@avp1598 Are you able to share a StackBlitz link for your fixed version?

markdalgleish avatar Sep 08 '22 23:09 markdalgleish

@markdalgleish hey so i just updated the original stackblitz with the fixed version. https://stackblitz.com/edit/next-typescript-by4kmo?file=pages/_app.tsx Basically need to update the AUTHENTICATION_STATUS as mentioned by @KaladinStormBlessed16 in the custom auth adapater, please add this info in the docs.

avp1598 avatar Sep 10 '22 04:09 avp1598