[GH-ISSUE #3495] Sign in with Solana (SIWS) #9624

Open
opened 2026-04-13 05:11:50 -05:00 by GiteaMirror · 20 comments
Owner

Originally created by @Re4GD on GitHub (Jul 20, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/3495

Sign in with Solana support, using wallets like Phantom, Solflare, Backpack etc. I have developed a plugin for Phantom only, but I can generalize my solution to apply for most Solana wallets.

I will post the plugin code when I strip private code off

Originally created by @Re4GD on GitHub (Jul 20, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/3495 Sign in with Solana support, using wallets like Phantom, Solflare, Backpack etc. I have developed a plugin for Phantom only, but I can generalize my solution to apply for most Solana wallets. I will post the plugin code when I strip private code off
GiteaMirror added the credentials label 2026-04-13 05:11:50 -05:00
Author
Owner

@Re4GD commented on GitHub (Jul 21, 2025):

I was originally planning to just share some code snippets, but I can open a PR instead and create the SIWS plugin (like SIWE) if that works better. Let me know if that’s okay, or if this plugin is already on the maintainer roadmap, @Kinfe123 @dagmawibabi

<!-- gh-comment-id:3097492242 --> @Re4GD commented on GitHub (Jul 21, 2025): I was originally planning to just share some code snippets, but I can open a PR instead and create the SIWS plugin (like SIWE) if that works better. Let me know if that’s okay, or if this plugin is already on the maintainer roadmap, @Kinfe123 @dagmawibabi
Author
Owner

@Kinfe123 commented on GitHub (Jul 21, 2025):

We don’t have one on the roadmap yet, but feel free to work on it and open a PR for the SIWS plugin.

<!-- gh-comment-id:3099662583 --> @Kinfe123 commented on GitHub (Jul 21, 2025): We don’t have one on the roadmap yet, but feel free to work on it and open a PR for the SIWS plugin.
Author
Owner

@ndarcode commented on GitHub (Jul 29, 2025):

i genuinely need this, ill be waiting for your plugin @Re4GD

<!-- gh-comment-id:3130732344 --> @ndarcode commented on GitHub (Jul 29, 2025): i genuinely need this, ill be waiting for your plugin @Re4GD
Author
Owner

@Re4GD commented on GitHub (Jul 29, 2025):

Currently working on the Telegram plugin, after that I will finish siws

<!-- gh-comment-id:3131105987 --> @Re4GD commented on GitHub (Jul 29, 2025): Currently working on the Telegram plugin, after that I will finish siws
Author
Owner

@puiusabin commented on GitHub (Aug 4, 2025):

i’m also interested in the solana plugin

<!-- gh-comment-id:3149738250 --> @puiusabin commented on GitHub (Aug 4, 2025): i’m also interested in the solana plugin
Author
Owner

@Re4GD commented on GitHub (Aug 4, 2025):

Almost done with Telegram plugin, waiting for some maintainer feedback. Meanwhile I’ll start siws

<!-- gh-comment-id:3150903213 --> @Re4GD commented on GitHub (Aug 4, 2025): Almost done with Telegram plugin, waiting for some maintainer feedback. Meanwhile I’ll start siws
Author
Owner

@MadgicDev commented on GitHub (Aug 9, 2025):

Super interested in this as well

<!-- gh-comment-id:3170142527 --> @MadgicDev commented on GitHub (Aug 9, 2025): Super interested in this as well
Author
Owner

@paschaldev commented on GitHub (Sep 23, 2025):

@Re4GD How do we contribute to siws?

I need this and I would like to put in work if you've started something

<!-- gh-comment-id:3325317912 --> @paschaldev commented on GitHub (Sep 23, 2025): @Re4GD How do we contribute to siws? I need this and I would like to put in work if you've started something
Author
Owner

@Re4GD commented on GitHub (Sep 23, 2025):

Hi, I will open a PR and push what I have in a few days. The plugin fully works, the last thing I wanted to implement is native callbacks (open Phantom from web with connect intent, user approves in Phantom and gets redirected to plugin callback endpoint like magic email). I can finish implementing that when I open a PR

<!-- gh-comment-id:3325534411 --> @Re4GD commented on GitHub (Sep 23, 2025): Hi, I will open a PR and push what I have in a few days. The plugin fully works, the last thing I wanted to implement is native callbacks (open Phantom from web with connect intent, user approves in Phantom and gets redirected to plugin callback endpoint like magic email). I can finish implementing that when I open a PR
Author
Owner

@beeman commented on GitHub (Sep 23, 2025):

@Re4GD awesome to hear you're working on this! Don't hesitate to reach out if you have any questions or need testers.

I'm the creator of wallet-ui and maintainer of create-solana-dapp and want to help make sure this all works smoothly!

<!-- gh-comment-id:3325639826 --> @beeman commented on GitHub (Sep 23, 2025): @Re4GD awesome to hear you're working on this! Don't hesitate to reach out if you have any questions or need testers. I'm the creator of [wallet-ui](https://github.com/wallet-ui/wallet-ui) and maintainer of [create-solana-dapp](https://github.com/solana-foundation/create-solana-dapp) and want to help make sure this all works smoothly!
Author
Owner

@Re4GD commented on GitHub (Sep 26, 2025):

Hey, I have pushed the working plugin to the PR, feel free to copy and use it in your own projects. There is no schema changes like the SIWE plugin for publicKey/address, so it works out of the box with default better auth tables.

I will finalize the plugin in the following days. Before I finish the PR, I will implement these:

  • Native callback endpoints and API will change
  • Add account linking for existing users
  • Convert the user creation data callback to oauth style mapProfileToUser
  • Add sns.id lookup like ens lookup in SIWE (I might not implement this, mapProfileToUser callback covers this)

Let me know if you want/need any other features. (the current state which I pushed to the PR is enough for my use case, and I assume would be enough for most people. However I am adding these additional features for completeness sake)

<!-- gh-comment-id:3340710695 --> @Re4GD commented on GitHub (Sep 26, 2025): Hey, I have pushed the working plugin to the PR, feel free to copy and use it in your own projects. There is no schema changes like the SIWE plugin for publicKey/address, so it works out of the box with default better auth tables. I will finalize the plugin in the following days. Before I finish the PR, I will implement these: - Native callback endpoints and API will change - Add account linking for existing users - Convert the user creation data callback to oauth style mapProfileToUser - Add sns.id lookup like ens lookup in SIWE (I might not implement this, mapProfileToUser callback covers this) Let me know if you want/need any other features. (the current state which I pushed to the PR is enough for my use case, and I assume would be enough for most people. However I am adding these additional features for completeness sake)
Author
Owner

@paschaldev commented on GitHub (Oct 14, 2025):

Got it. Thank you @Re4GD

I'll be keeping tab for when this gets merged in

https://github.com/better-auth/better-auth/pull/4882

<!-- gh-comment-id:3403849739 --> @paschaldev commented on GitHub (Oct 14, 2025): Got it. Thank you @Re4GD I'll be keeping tab for when this gets merged in https://github.com/better-auth/better-auth/pull/4882
Author
Owner

@reslear commented on GitHub (Oct 16, 2025):

I think next version of better-auth SIWE. should be a better to do something like siwx right away to support other networks across multiple blockchain, such as Ethereum, Polygon or Sui.

We need to add a network field to the database and do a bit of coding — make the current implementation more universal, remove ETH specific functions, remove dependencies for ETH, etc.,

Provide a way for the developer to handle this manually on their side, rather than through better-auth.

<!-- gh-comment-id:3412201618 --> @reslear commented on GitHub (Oct 16, 2025): I think next version of better-auth SIWE. should be a better to do something like [siwx](https://docs.reown.com/appkit/vue/core/siwx-custom) right away to support other networks across multiple blockchain, such as Ethereum, Polygon or Sui. We need to add a `network` field to the database and do a bit of coding — make the current implementation more universal, remove ETH specific functions, remove dependencies for ETH, etc., Provide a way for the developer to handle this manually on their side, rather than through better-auth.
Author
Owner

@Re4GD commented on GitHub (Oct 16, 2025):

Good idea, I’ve been thinking about that too and designed most of the plugin (nonce generation, message generation, message verification, address verification etc) as overridable custom functions with default solana fallbacks. I think with some adjustments you can even use this plugin as siwx, however as of now this is only solana.

Also, one thing that has bothering me is how siwe plugin handles account information. It adds a publicKey field to the user table and I dont want that. The current siws plugin does not make any changes. We can put all chainId, mainnet/devnet, address info into Account.accountId without cluttering the base schemas. Another reason to do siwx I guess.

Maybe after I finish this plugin I can generalize the solution and create a siwx plugin, similar to the link you have sent. The tricky part is unifying all the steps for all chains (which is not a very easy task), and also supporting native application callbacks (native phantom/metamask/trust redirects, confirms etc). It should be doable by offloading almost all logic to the user by exposing the right hooks.

<!-- gh-comment-id:3412272000 --> @Re4GD commented on GitHub (Oct 16, 2025): Good idea, I’ve been thinking about that too and designed most of the plugin (nonce generation, message generation, message verification, address verification etc) as overridable custom functions with default solana fallbacks. I think with some adjustments you can even use this plugin as siwx, however as of now this is only solana. Also, one thing that has bothering me is how siwe plugin handles account information. It adds a publicKey field to the user table and I dont want that. The current siws plugin does not make any changes. We can put all chainId, mainnet/devnet, address info into Account.accountId without cluttering the base schemas. Another reason to do siwx I guess. Maybe after I finish this plugin I can generalize the solution and create a siwx plugin, similar to the link you have sent. The tricky part is unifying all the steps for all chains (which is not a very easy task), and also supporting native application callbacks (native phantom/metamask/trust redirects, confirms etc). It should be doable by offloading almost all logic to the user by exposing the right hooks.
Author
Owner

@grmkris commented on GitHub (Jan 3, 2026):

hellooo @Re4GD any progress?

<!-- gh-comment-id:3707396292 --> @grmkris commented on GitHub (Jan 3, 2026): hellooo @Re4GD any progress?
Author
Owner

@coopbri commented on GitHub (Jan 3, 2026):

hellooo @Re4GD any progress?

@grmkris I was waiting for his work on SIWX (WIP PR, planning on getting it ready very soon: https://github.com/better-auth/better-auth/issues/6738) but decided to just get rolling on it, I need it in production soon. Wondering if 1) you would be interested in that for your own projects instead of just SIWS, and 2) (if so) if you prefer the non-core-schema changes approach in this plugin (vs. the core schema changes in the official SIWE plugin)

<!-- gh-comment-id:3707455812 --> @coopbri commented on GitHub (Jan 3, 2026): > hellooo [@Re4GD](https://github.com/Re4GD) any progress? @grmkris I was waiting for his work on SIWX (WIP PR, planning on getting it ready very soon: https://github.com/better-auth/better-auth/issues/6738) but decided to just get rolling on it, I need it in production soon. Wondering if 1) you would be interested in that for your own projects instead of just SIWS, and 2) (if so) if you prefer the non-core-schema changes approach in this plugin (vs. the core schema changes in the [official SIWE plugin](https://www.better-auth.com/docs/plugins/siwe))
Author
Owner

@grmkris commented on GitHub (Jan 4, 2026):

Hey, thanks for the reply! In my own project, I would like to use siwx, so Ethereum, Solana, Bitcoin. I don't think we can do without schema changes. We need to store chain namespace and I'll be looking at the re-own specs. We also need to store the signature and the message that was used. So I don't think we can go around not storing it. Like to have a full and proper integration. I'm also working on something on my own, so I'll send you the link once I have it.

<!-- gh-comment-id:3708142911 --> @grmkris commented on GitHub (Jan 4, 2026): Hey, thanks for the reply! In my own project, I would like to use siwx, so Ethereum, Solana, Bitcoin. I don't think we can do without schema changes. We need to store chain namespace and I'll be looking at the re-own specs. We also need to store the signature and the message that was used. So I don't think we can go around not storing it. Like to have a full and proper integration. I'm also working on something on my own, so I'll send you the link once I have it.
Author
Owner

@coopbri commented on GitHub (Jan 6, 2026):

Hey, thanks for the reply! In my own project, I would like to use siwx, so Ethereum, Solana, Bitcoin. I don't think we can do without schema changes. We need to store chain namespace and I'll be looking at the re-own specs. We also need to store the signature and the message that was used. So I don't think we can go around not storing it. Like to have a full and proper integration. I'm also working on something on my own, so I'll send you the link once I have it.

Amazing, let me know if I can help, would love to collab

coopbri on Discord / 0xcoop on X

<!-- gh-comment-id:3716387085 --> @coopbri commented on GitHub (Jan 6, 2026): > Hey, thanks for the reply! In my own project, I would like to use siwx, so Ethereum, Solana, Bitcoin. I don't think we can do without schema changes. We need to store chain namespace and I'll be looking at the re-own specs. We also need to store the signature and the message that was used. So I don't think we can go around not storing it. Like to have a full and proper integration. I'm also working on something on my own, so I'll send you the link once I have it. Amazing, let me know if I can help, would love to collab `coopbri` on Discord / `0xcoop` on X
Author
Owner

@grmkris commented on GitHub (Jan 6, 2026):

helllo ser, i built the plugin https://github.com/grmkris/yoda.fun/blob/main/packages/auth/src/plugins/siwx.ts
it is half vibe coded, half serious hahah... i was trying to make it work and was quite tired since my project was a hackathon project so maybe it has some security holes, but all in all in works quite reliably...https://github.com/grmkris/yoda.fun/blob/main/apps/web/src/lib/siwx/better-auth-siwx.ts

i think there is lots of room for improvement, maybe we can work together to publish it as a standalone package?

my hackathon project is here if ur interested to see https://x.com/_krisgg/status/2008400961459388417

<!-- gh-comment-id:3716606599 --> @grmkris commented on GitHub (Jan 6, 2026): helllo ser, i built the plugin https://github.com/grmkris/yoda.fun/blob/main/packages/auth/src/plugins/siwx.ts it is half vibe coded, half serious hahah... i was trying to make it work and was quite tired since my project was a hackathon project so maybe it has some security holes, but all in all in works quite reliably...https://github.com/grmkris/yoda.fun/blob/main/apps/web/src/lib/siwx/better-auth-siwx.ts i think there is lots of room for improvement, maybe we can work together to publish it as a standalone package? my hackathon project is here if ur interested to see https://x.com/_krisgg/status/2008400961459388417
Author
Owner

@coopbri commented on GitHub (Jan 11, 2026):

helllo ser, i built the plugin https://github.com/grmkris/yoda.fun/blob/main/packages/auth/src/plugins/siwx.ts it is half vibe coded, half serious hahah... i was trying to make it work and was quite tired since my project was a hackathon project so maybe it has some security holes, but all in all in works quite reliably...https://github.com/grmkris/yoda.fun/blob/main/apps/web/src/lib/siwx/better-auth-siwx.ts

i think there is lots of room for improvement, maybe we can work together to publish it as a standalone package?

my hackathon project is here if ur interested to see https://x.com/_krisgg/status/2008400961459388417

Oh awesome! I ended up implementing #7238, pending BA team review, but might use this as reference.

Yes I just followed ya on X let's connect, good to find more people in crypto, we building the future fren 🤝

<!-- gh-comment-id:3735796447 --> @coopbri commented on GitHub (Jan 11, 2026): > helllo ser, i built the plugin https://github.com/grmkris/yoda.fun/blob/main/packages/auth/src/plugins/siwx.ts it is half vibe coded, half serious hahah... i was trying to make it work and was quite tired since my project was a hackathon project so maybe it has some security holes, but all in all in works quite reliably...https://github.com/grmkris/yoda.fun/blob/main/apps/web/src/lib/siwx/better-auth-siwx.ts > > i think there is lots of room for improvement, maybe we can work together to publish it as a standalone package? > > my hackathon project is here if ur interested to see https://x.com/_krisgg/status/2008400961459388417 Oh awesome! I ended up implementing #7238, pending BA team review, but might use this as reference. Yes I just followed ya on X let's connect, good to find more people in crypto, we building the future fren 🤝
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9624