-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auth): Add
signInAnonymously
(#297)
* feat(auth): add `signInAnonymously` method * Add tests
- Loading branch information
Showing
8 changed files
with
135 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// SignInAnonymously.swift | ||
// Examples | ||
// | ||
// Created by Guilherme Souza on 01/04/24. | ||
// | ||
|
||
import Supabase | ||
import SwiftUI | ||
|
||
struct SignInAnonymously: View { | ||
var body: some View { | ||
Button("Sign in") { | ||
Task { | ||
do { | ||
try await supabase.auth.signInAnonymously() | ||
} catch { | ||
debug("Error signin in anonymously: \(error)") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
SignInAnonymously() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
Tests/AuthTests/__Snapshots__/RequestsTests/testSignInAnonymously.1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
curl \ | ||
--request POST \ | ||
--header "Apikey: dummy.api.key" \ | ||
--header "Content-Type: application/json" \ | ||
--header "X-Client-Info: gotrue-swift/x.y.z" \ | ||
--data "{\"data\":{\"custom_key\":\"custom_value\"},\"gotrue_meta_security\":{\"captcha_token\":\"captcha-token\"}}" \ | ||
"http://localhost:54321/auth/v1/signup" |