You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 13, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+7-55Lines changed: 7 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
3
3
A Dart client for [Supabase](https://supabase.io/).
4
4
5
+
> **Note**
6
+
>
7
+
> If you are developing a Flutter application, use [supabase_flutter](https://pub.dev/packages/supabase_flutter) instead. `supabase` package is for non-Flutter Dart environments.
This package does not persist auth state automatically. Use [supabase_flutter](https://pub.dev/packages/supabase_flutter) for Flutter apps to persist auth state instead of this package.
101
+
96
102
```dart
97
103
import 'package:supabase/supabase.dart';
98
104
@@ -124,62 +130,8 @@ main() {
124
130
}
125
131
```
126
132
127
-
## Authentication
128
-
129
-
Initialize a [`SupabaseClient`](https://supabase.com/docs/reference/dart/initializing#access-supabaseclient-instance) by passing your **Supabase URL** and **Supabase KEY**. The keys can be found in your supabase project in `/setting/API`.
130
-
131
-
```dart
132
-
final client = SupabaseClient('supabaseUrl', 'supabaseKey');
133
-
```
134
-
135
-
The `client` has a [`auth`](https://pub.dev/documentation/supabase/latest/supabase/SupabaseClient/auth.html) attribute (of type [`GoTrueClient`](https://pub.dev/documentation/gotrue/latest/gotrue/GoTrueClient-class.html)) that you can use to authenticate your users using supabase.
136
-
137
-
### Sign up
138
-
139
-
Use the [`signUp`](https://supabase.com/docs/reference/dart/auth-signup) method to create a new user account.
140
-
141
-
```dart
142
-
// Sign up user with email and password
143
-
final response = await supabase.auth.signUp(email: email, password: password);
144
-
final Session? session = response.session;
145
-
final User? user = response.user;
146
-
```
147
-
148
-
### Sign in
149
-
150
-
There are a few ways to sign in a user into your app.
151
-
152
-
Use the [`signInWithPassword`](https://supabase.com/docs/reference/dart/auth-signinwithpassword) method to sign in a user with their email or phone with password.
153
-
154
-
```dart
155
-
// Sign in user with email and password
156
-
final response = await client.auth.signInWithPassword(email: email, password: password);
157
-
final Session? session = response.session;
158
-
final User? user = response.user;
159
-
```
160
-
161
-
Use the [`signInWithOtp`](https://supabase.com/docs/reference/dart/auth-signinwithotp) method to sign in a user using magic link with email or one time password using phone number.
162
-
163
-
```dart
164
-
// Sign in user with email and password
165
-
await client.auth.signInWithOtp(email: email);
166
-
```
167
-
168
-
169
-
### Sign out
170
-
171
-
Use the [`signOut`](https://supabase.com/docs/reference/dart/auth-signout) method to sign out a user.
172
-
173
-
```dart
174
-
// Sign out user
175
-
await client.auth.signOut();
176
-
```
177
-
178
133
Check out the [**Official Documentation**](https://supabase.com/docs/reference/dart/) to learn all the other available methods.
0 commit comments