docs(examples): add Sign in with MetaMask (SIWE) example#1139
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe Examples app now links the Sequence Diagram(s)sequenceDiagram
participant SignInWithMetaMaskView
participant SignInWithMetaMaskController
participant MetaMaskSDK
participant SupabaseAuth
SignInWithMetaMaskView->>SignInWithMetaMaskController: Start connection or sign-in
SignInWithMetaMaskController->>MetaMaskSDK: Connect or request personal_sign
MetaMaskSDK-->>SignInWithMetaMaskController: Return account, chain, signature, or callback URL
SignInWithMetaMaskController->>SupabaseAuth: Submit Web3 credentials
SupabaseAuth-->>SignInWithMetaMaskView: Display session or error
Possibly related PRs
Suggested labels: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The following capabilities are marked
These may have been renamed, removed, or never registered. Please update the capability matrix. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Examples/Examples/Auth/SignInWithMetaMask.swift`:
- Around line 81-82: Update the signRequest construction in the
SignInWithMetaMask flow to pass personalSign parameters in the required order:
address first, followed by message. Keep the existing EthereumRequest and
metamaskSDK.request flow unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d35e1f4a-156f-4f60-ad73-a619ace9320a
⛔ Files ignored due to path filters (2)
Package.resolvedis excluded by!**/Package.resolvedSupabase.xcworkspace/xcshareddata/swiftpm/Package.resolvedis excluded by!**/Package.resolved
📒 Files selected for processing (14)
Examples/Examples.xcodeproj/project.pbxprojExamples/Examples/Auth/AuthExamplesView.swiftExamples/Examples/Auth/SignInWithMetaMask.swiftExamples/Examples/Info.plistExamples/README.mdPackage.swiftSources/Auth/AuthClient.swiftSources/Auth/AuthError.swiftSources/Auth/Types.swiftTests/AuthTests/AuthClientTests.swiftTests/IntegrationTests/AuthClientIntegrationTests.swiftTests/IntegrationTests/supabase/config.tomldictionary.txtsdk-compliance.yaml
There was a problem hiding this comment.
I thought Solana wasn't supported? As per the PR description at least
There was a problem hiding this comment.
i think it's supported in the auth server at least
There was a problem hiding this comment.
There was a problem hiding this comment.
I guess the PR description was just not accurate then
19ea10c to
5197c08
Compare
Coverage Report for CI Build 29960064069Coverage decreased (-0.2%) to 83.628%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions17 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
The SIWE message hardcoded `URI: https://supabase.com`, which the backend rejects with `invalid_grant` ("message was signed for another app") for any real project, since that URI is never on a project's own redirect allow-list. Switch to `http://localhost:3000`, matching the placeholder already used by this SDK's own integration tests, and document the required Additional Redirect URLs entry in the README.
5197c08 to
afc00aa
Compare
Summary
Stacked on #1138 (adds
AuthClient.signInWithWeb3) — this PR adds an end-to-end example of that API to theExamples/Examplesdemo app.ExamplesXcode target — no new target.Examples/Examples/Auth/SignInWithMetaMask.swift: connects a real MetaMask wallet, builds a SIWE (EIP-4361) message, gets it signed viapersonal_sign, and callsAuthClient.signInWithWeb3.#if canImport(UIKit)-gated), matching the existingSignInWithOAuthViewControllerexample's platform scoping.Two non-obvious correctness details worth knowing about, both verified against the MetaMask SDK's real source and this repo's own
signInWithWeb3backend contract:personal_signparams are sent as[message, address]— the SDK's ownpersonalSign(message:address:)convenience method sends the opposite order ([address, message]), which contradicts both the JSON-RPC spec and the SDK's own example app. This PR builds the request manually with the correct order.chainIdis hex (e.g.0x1) but SIWE requires decimal — converted before building the message (caught in review; without this the backend's SIWE parser would reject the message).Test plan
xcodebuild -workspace Supabase.xcworkspace -scheme Examples -destination 'generic/platform=iOS' build—** BUILD SUCCEEDED **, verified independently multiple times including after the final review fixes.Manual e2e test
ScreenRecording_07-22-2026.12-31-50_1.MP4