-
-
Notifications
You must be signed in to change notification settings - Fork 244
Expand file tree
/
Copy pathAuthExamplesView.swift
More file actions
124 lines (111 loc) · 3.34 KB
/
AuthExamplesView.swift
File metadata and controls
124 lines (111 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//
// AuthExamplesView.swift
// Examples
//
// Demonstrates all authentication methods available in Supabase Auth
//
import SwiftUI
struct AuthExamplesView: View {
var body: some View {
List {
Section {
Text("Explore authentication methods and user management with Supabase Auth")
.font(.subheadline)
.foregroundColor(.secondary)
}
Section("Email Authentication") {
NavigationLink(destination: AuthWithEmailAndPassword()) {
ExampleRow(
title: "Email & Password",
description: "Sign up and sign in with email and password",
icon: "envelope.fill"
)
}
NavigationLink(destination: AuthWithMagicLink()) {
ExampleRow(
title: "Magic Link",
description: "Passwordless authentication via email",
icon: "link.circle.fill"
)
}
}
Section("Phone Authentication") {
NavigationLink(destination: SignInWithPhone()) {
ExampleRow(
title: "Phone OTP",
description: "Sign in with phone number and verification code",
icon: "phone.fill"
)
}
}
Section("Social Authentication") {
NavigationLink(destination: SignInWithApple()) {
ExampleRow(
title: "Sign in with Apple",
description: "Apple ID authentication",
icon: "apple.logo"
)
}
NavigationLink(destination: SignInWithFacebook()) {
ExampleRow(
title: "Sign in with Facebook",
description: "Facebook social authentication",
icon: "f.circle.fill"
)
}
NavigationLink(destination: SignInWithOAuth()) {
ExampleRow(
title: "OAuth Providers",
description: "Generic OAuth flow for various providers",
icon: "person.crop.circle.badge.checkmark"
)
}
#if canImport(UIKit)
NavigationLink(
destination: UIViewControllerWrapper(SignInWithOAuthViewController())
.edgesIgnoringSafeArea(.all)
) {
ExampleRow(
title: "OAuth with UIKit",
description: "OAuth authentication using UIKit",
icon: "rectangle.portrait.and.arrow.right"
)
}
#endif
NavigationLink(destination: GoogleSignInSDKFlow()) {
ExampleRow(
title: "Google Sign-In SDK",
description: "Google authentication using official SDK",
icon: "g.circle.fill"
)
}
}
Section("Guest Access") {
NavigationLink(destination: SignInAnonymously()) {
ExampleRow(
title: "Anonymous Sign In",
description: "Create temporary anonymous sessions",
icon: "person.fill.questionmark"
)
}
}
#if canImport(LocalAuthentication)
Section("Security") {
NavigationLink(destination: BiometricsExample()) {
ExampleRow(
title: "Biometrics",
description: "Protect session access with Face ID / Touch ID",
icon: "faceid"
)
}
}
#endif
}
.navigationTitle("Authentication")
}
}
#Preview {
NavigationStack {
AuthExamplesView()
}
}