QwikDev / qwik

Instant-loading web apps, without effort
https://qwik.dev
MIT License
20.46k stars 1.26k forks source link

[πŸ“–] Integration Issue with SIWE and Auth.js Credentials Provider #5219

Closed neotheprogramist closed 2 days ago

neotheprogramist commented 9 months ago

Provider type

Credentials

Environment

System: OS: Linux 6.4 Fedora Linux 38 (Workstation Edition) CPU: (16) x64 AMD Ryzen 7 PRO 6850U with Radeon Graphics Memory: 6.39 GB / 14.38 GB Container: Yes Shell: 5.2.15 - /bin/bash Binaries: Node: 18.17.1 - /usr/bin/node npm: 9.8.1 - /usr/local/bin/npm Browsers: Chrome: 117.0.5938.92 Packages: "@auth/core": "^0.13.0", "@builder.io/qwik": "^1.2.12", "@builder.io/qwik-auth": "0.1.3", "@builder.io/qwik-city": "^1.2.12",

Reproduction URL

https://github.com/visoftsolutions/ksox-web/tree/authjs-credential-dead-end/exchange

Describe the issue

I'm facing a problem when trying to integrate Sign-In with Ethereum (SIWE) with Auth.js as per this guide. There's no straightforward way to pass the 'message' and 'signature' credentials from SIWE to Auth.js's Credential provider programmatically. The current implementation redirects users to a page where they're prompted to enter these credentials manually.

How to reproduce

In the repo https://github.com/visoftsolutions/ksox-web

run redis db

podman run -p 6379:6379 -p 8001:8001 -it redis/redis-stack:latest

run dev

npm run dev -w exchange

and go to http://localhost:5173/siwe/

Expected behavior

I'd like to pass the SIWE credentials to Auth.js's Credential provider programmatically, without redirecting users for manual input. Solving this would make Qwik a more viable option for web3 applications alongside React.

neotheprogramist commented 9 months ago

My workspace is over here https://github.com/visoftsolutions/ksox-web/tree/authjs-credential-dead-end/exchange/src/routes/siwe

mhevery commented 9 months ago

I am not an expert in this area, but perhaps we can figure this out together.

What would you expect qwik to change in its current implementation to fix this?

neotheprogramist commented 9 months ago

It seems for me to be very heplful if qwik-auth exports some way to pass credentials to the Credential Provider like shown here in the next repo https://github.com/spruceid/siwe-next-auth-example/blob/main/pages/siwe.tsx#L32-L37

The equivalent code that tries to do something similar (but fails) in my repo is here https://github.com/visoftsolutions/ksox-web/blob/authjs-credential-dead-end/exchange/src/routes/siwe/index.tsx#L126 It seems like redirect: false option doesn't make any effect.

It would be perfect if there is any documentation how to use @builder.io/qwik-auth with siwe to let users sign with Ethereum

mhevery commented 9 months ago

Could you create a PR to fix https://github.com/BuilderIO/qwik/blob/main/packages/qwik-auth/src/index.ts so that it can do what you are looking for?

neotheprogramist commented 9 months ago

We may arrange a call and discuss if such modification is possible and how to properly do that

mhevery commented 9 months ago

Who is we? You mean you and me?

neotheprogramist commented 9 months ago

Yes, or me and a somebody who worked on qwik-auth

mhevery commented 9 months ago

Sorry, the person who worked on it is currently working on a priority item. Can we resolve this async? What change needs to be made? Or better yet, can you make a change and propose a PR?

github-actions[bot] commented 2 weeks ago

Hello @neotheprogramist. Please provide the missing information requested above. Issues marked with STATUS-2: missing info will be automatically closed if they have no activity within 14 days. Thanks πŸ™