Support Sign In With Solana (SIWS) #32532
Replies: 5 comments 4 replies
-
one of the main objectives here is to provide one of our larger customers the ability to use SIWS with Realtime +AuthZ, so a demonstration of that capability would be great 👍 |
Beta Was this translation helpful? Give feedback.
-
Hey I'm on the Auth team and wanted to share some ideas as to how this should be implemented in the server to hopefully minimize back-and-forth and have something that can be maintained by the team long term. First off, Supabase Auth does not have hosted pages nor will it in the mid-term. Please base the implementation around this limitation. Given that both SIWS and SIWE (and all other semi-failed web3 protocols) rely on verifying a signed message by the wallet it would be best to follow these guidelines:
|
Beta Was this translation helpful? Give feedback.
-
Hi, I built @DeAuthXyz , a solana oauth solution which won a solana hyperdrive hackathon, I’m very well versed in this, I’m taking a look now. |
Beta Was this translation helpful? Give feedback.
-
Looks good guys! can we built this so that that it supports more chains? or so that we can at least extend it later a la
so that we don't end up with separate implementations for each and a long list of:
|
Beta Was this translation helpful? Give feedback.
-
Hello, I've built a minimal example, not sure if i should submit a PR or discuss here first: https://github.com/Bewinxed/auth
since siws/siwe use eip4361, i added the grant type eip4361, which can extend eth/sol and any compatible network, which can be specified in the .env then based on the chosen network e.g solana:mainnet the appropriate validation will be used. I've implemented a siws package inside internal/utilities/siws that implement many of the necessary siws functions (need to review them to double check the validations). for solana, I tried a no-dependency validation however i added the btc base58 package as for ethereum, I'm, using the ethereum-go package, which is widely supported, but perhaps we can omit and try to implement a native validation without the dep. In the root folder, there is a external_eip4361_siws_example.go built it, spun up the server: await fetch("http://localhost:9999/token?grant_type=eip4361", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({"address":"J79fnBJGPeizHNYR1AGqRFRiWMQAEJLNu3ePoSWA7Zb3","chain":"solana:mainnet","grant_type":"eip4361","message":"localhost:9999 wants you to sign in with your Solana account:\nJ79fnBJGPeizHNYR1AGqRFRiWMQAEJLNu3ePoSWA7Zb3\n\nSign in with your Solana account\nURI: https://example.com\nVersion: 1\nNonce: 90cf4f06e021297d80363477774ce7f7\nIssued At: 2025-01-17T18:30:31Z\n","signature":"iWW0I/rbGwXwxj6v8oBTraQ39f84Oewo7bk7OyHwkwTx8FmswtpU+eR4gAZGrqRtrEDtXyFPuDbmYZzoEz2DDg=="})})
.then(response => response.json())
.then(data => console.log("Response:", data))
.catch(error => console.error("Error:", error));
```
response:
```json
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIzNzJiMmZiYi02YTM4LTQ4ZTUtOWQ0ZC0xOGJlMzMwMjFjYTIiLCJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNzM3MTQyMzc2LCJpYXQiOjE3MzcxMzg3NzYsImVtYWlsIjoiIiwicGhvbmUiOiIiLCJhcHBfbWV0YWRhdGEiOnsicHJvdmlkZXIiOiJlaXA0MzYxIiwicHJvdmlkZXJzIjpbImVpcDQzNjEiXX0sInVzZXJfbWV0YWRhdGEiOnsiY3VzdG9tX2NsYWltcyI6eyJhZGRyZXNzIjoiSjc5Zm5CSkdQZWl6SE5ZUjFBR3FSRlJpV01RQUVKTE51M2VQb1NXQTdaYjMiLCJjaGFpbiI6InNvbGFuYTptYWlubmV0Iiwicm9sZSI6ImF1dGhlbnRpY2F0ZWQifSwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJwaG9uZV92ZXJpZmllZCI6ZmFsc2UsInN1YiI6InNvbGFuYTptYWlubmV0Oko3OWZuQkpHUGVpekhOWVIxQUdxUkZSaVdNUUFFSkxOdTNlUG9TV0E3WmIzIn0sInJvbGUiOiJhdXRoZW50aWNhdGVkIiwiYWFsIjoiYWFsMSIsImFtciI6W3sibWV0aG9kIjoid2ViMyIsInRpbWVzdGFtcCI6MTczNzEzODc3Nn1dLCJzZXNzaW9uX2lkIjoiMTY0NWU4MTItMzE0OC00Mjg2LTljOTItNzQyNGE0OGM3OWMzIiwiaXNfYW5vbnltb3VzIjpmYWxzZX0.yizc-IeK73DDz8xw3UBO_pLI8a_ttjldAuDokCF8y_k",
"token_type": "bearer",
"expires_in": 3600,
"expires_at": 1737142376,
"refresh_token": "J2EY1jvVd2SF343fIgVwyw",
"user": {
"id": "372b2fbb-6a38-48e5-9d4d-18be33021ca2",
"aud": "authenticated",
"role": "authenticated",
"email": "",
"email_confirmed_at": "2025-01-17T21:30:41.607863+03:00",
"phone": "",
"confirmed_at": "2025-01-17T21:30:41.607863+03:00",
"last_sign_in_at": "2025-01-17T21:32:56.1850242+03:00",
"app_metadata": {
"provider": "eip4361",
"providers": [
"eip4361"
]
},
"user_metadata": {
"custom_claims": {
"address": "J79fnBJGPeizHNYR1AGqRFRiWMQAEJLNu3ePoSWA7Zb3",
"chain": "solana:mainnet",
"role": "authenticated"
},
"email_verified": false,
"phone_verified": false,
"sub": "solana:mainnet:J79fnBJGPeizHNYR1AGqRFRiWMQAEJLNu3ePoSWA7Zb3"
},
"identities": [
{
"identity_id": "567bf4c0-65f4-4917-aa35-96a80b6fcc5c",
"id": "solana:mainnet:J79fnBJGPeizHNYR1AGqRFRiWMQAEJLNu3ePoSWA7Zb3",
"user_id": "372b2fbb-6a38-48e5-9d4d-18be33021ca2",
"identity_data": {
"custom_claims": {
"address": "J79fnBJGPeizHNYR1AGqRFRiWMQAEJLNu3ePoSWA7Zb3",
"chain": "solana:mainnet",
"role": "authenticated"
},
"email_verified": false,
"phone_verified": false,
"sub": "solana:mainnet:J79fnBJGPeizHNYR1AGqRFRiWMQAEJLNu3ePoSWA7Zb3"
},
"provider": "eip4361",
"last_sign_in_at": "2025-01-17T21:30:41.589565+03:00",
"created_at": "2025-01-17T21:30:41.590111+03:00",
"updated_at": "2025-01-17T21:30:41.590111+03:00"
}
],
"created_at": "2025-01-17T21:30:41.579424+03:00",
"updated_at": "2025-01-17T21:32:56.19047+03:00",
"is_anonymous": false
}
} |
Beta Was this translation helpful? Give feedback.
-
Feature Request: Integrate Sign In With Solana into Supabase Auth
Overview
Add support for Sign In With Solana (SIWS) as a new authentication provider in Supabase Auth, allowing users to authenticate using their Solana wallets through a standardized, secure protocol.
Motivation
Technical Implementation
Required Changes
/authorize?provider=solana
Integration Points
Security Considerations
Dependencies
Success Metrics
Future Considerations
Beta Was this translation helpful? Give feedback.
All reactions