@supabase/auth-js 2.99.0 → 2.99.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/GoTrueClient.d.ts +167 -0
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +167 -0
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/module/GoTrueClient.d.ts +167 -0
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +167 -0
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/GoTrueClient.ts +167 -0
- package/src/lib/version.ts +1 -1
|
@@ -135,6 +135,173 @@ export default class GoTrueClient {
|
|
|
135
135
|
*
|
|
136
136
|
* @returns A logged-in session if the server has "autoconfirm" ON
|
|
137
137
|
* @returns A user if the server has "autoconfirm" OFF
|
|
138
|
+
*
|
|
139
|
+
* @category Auth
|
|
140
|
+
*
|
|
141
|
+
* @remarks
|
|
142
|
+
* - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](/dashboard/project/_/auth/providers).
|
|
143
|
+
* - **Confirm email** determines if users need to confirm their email address after signing up.
|
|
144
|
+
* - If **Confirm email** is enabled, a `user` is returned but `session` is null.
|
|
145
|
+
* - If **Confirm email** is disabled, both a `user` and a `session` are returned.
|
|
146
|
+
* - When the user confirms their email address, they are redirected to the [`SITE_URL`](/docs/guides/auth/redirect-urls#use-wildcards-in-redirect-urls) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](/dashboard/project/_/auth/url-configuration).
|
|
147
|
+
* - If signUp() is called for an existing confirmed user:
|
|
148
|
+
* - When both **Confirm email** and **Confirm phone** (even when phone provider is disabled) are enabled in [your project](/dashboard/project/_/auth/providers), an obfuscated/fake user object is returned.
|
|
149
|
+
* - When either **Confirm email** or **Confirm phone** (even when phone provider is disabled) is disabled, the error message, `User already registered` is returned.
|
|
150
|
+
* - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser).
|
|
151
|
+
*
|
|
152
|
+
* @example Sign up with an email and password
|
|
153
|
+
* ```js
|
|
154
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
155
|
+
* email: 'example@email.com',
|
|
156
|
+
* password: 'example-password',
|
|
157
|
+
* })
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* @exampleResponse Sign up with an email and password
|
|
161
|
+
* ```json
|
|
162
|
+
* // Some fields may be null if "confirm email" is enabled.
|
|
163
|
+
* {
|
|
164
|
+
* "data": {
|
|
165
|
+
* "user": {
|
|
166
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
167
|
+
* "aud": "authenticated",
|
|
168
|
+
* "role": "authenticated",
|
|
169
|
+
* "email": "example@email.com",
|
|
170
|
+
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
171
|
+
* "phone": "",
|
|
172
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
173
|
+
* "app_metadata": {
|
|
174
|
+
* "provider": "email",
|
|
175
|
+
* "providers": [
|
|
176
|
+
* "email"
|
|
177
|
+
* ]
|
|
178
|
+
* },
|
|
179
|
+
* "user_metadata": {},
|
|
180
|
+
* "identities": [
|
|
181
|
+
* {
|
|
182
|
+
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
183
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
184
|
+
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
185
|
+
* "identity_data": {
|
|
186
|
+
* "email": "example@email.com",
|
|
187
|
+
* "email_verified": false,
|
|
188
|
+
* "phone_verified": false,
|
|
189
|
+
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
190
|
+
* },
|
|
191
|
+
* "provider": "email",
|
|
192
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
193
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
194
|
+
* "updated_at": "2024-01-01T00:00:00Z",
|
|
195
|
+
* "email": "example@email.com"
|
|
196
|
+
* }
|
|
197
|
+
* ],
|
|
198
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
199
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
200
|
+
* },
|
|
201
|
+
* "session": {
|
|
202
|
+
* "access_token": "<ACCESS_TOKEN>",
|
|
203
|
+
* "token_type": "bearer",
|
|
204
|
+
* "expires_in": 3600,
|
|
205
|
+
* "expires_at": 1700000000,
|
|
206
|
+
* "refresh_token": "<REFRESH_TOKEN>",
|
|
207
|
+
* "user": {
|
|
208
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
209
|
+
* "aud": "authenticated",
|
|
210
|
+
* "role": "authenticated",
|
|
211
|
+
* "email": "example@email.com",
|
|
212
|
+
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
213
|
+
* "phone": "",
|
|
214
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
215
|
+
* "app_metadata": {
|
|
216
|
+
* "provider": "email",
|
|
217
|
+
* "providers": [
|
|
218
|
+
* "email"
|
|
219
|
+
* ]
|
|
220
|
+
* },
|
|
221
|
+
* "user_metadata": {},
|
|
222
|
+
* "identities": [
|
|
223
|
+
* {
|
|
224
|
+
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
225
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
226
|
+
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
227
|
+
* "identity_data": {
|
|
228
|
+
* "email": "example@email.com",
|
|
229
|
+
* "email_verified": false,
|
|
230
|
+
* "phone_verified": false,
|
|
231
|
+
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
232
|
+
* },
|
|
233
|
+
* "provider": "email",
|
|
234
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
235
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
236
|
+
* "updated_at": "2024-01-01T00:00:00Z",
|
|
237
|
+
* "email": "example@email.com"
|
|
238
|
+
* }
|
|
239
|
+
* ],
|
|
240
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
241
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
242
|
+
* }
|
|
243
|
+
* }
|
|
244
|
+
* },
|
|
245
|
+
* "error": null
|
|
246
|
+
* }
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* @example Sign up with a phone number and password (SMS)
|
|
250
|
+
* ```js
|
|
251
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
252
|
+
* phone: '123456789',
|
|
253
|
+
* password: 'example-password',
|
|
254
|
+
* options: {
|
|
255
|
+
* channel: 'sms'
|
|
256
|
+
* }
|
|
257
|
+
* })
|
|
258
|
+
* ```
|
|
259
|
+
*
|
|
260
|
+
* @exampleDescription Sign up with a phone number and password (whatsapp)
|
|
261
|
+
* The user will be sent a WhatsApp message which contains a OTP. By default, a given user can only request a OTP once every 60 seconds. Note that a user will need to have a valid WhatsApp account that is linked to Twilio in order to use this feature.
|
|
262
|
+
*
|
|
263
|
+
* @example Sign up with a phone number and password (whatsapp)
|
|
264
|
+
* ```js
|
|
265
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
266
|
+
* phone: '123456789',
|
|
267
|
+
* password: 'example-password',
|
|
268
|
+
* options: {
|
|
269
|
+
* channel: 'whatsapp'
|
|
270
|
+
* }
|
|
271
|
+
* })
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* @example Sign up with additional user metadata
|
|
275
|
+
* ```js
|
|
276
|
+
* const { data, error } = await supabase.auth.signUp(
|
|
277
|
+
* {
|
|
278
|
+
* email: 'example@email.com',
|
|
279
|
+
* password: 'example-password',
|
|
280
|
+
* options: {
|
|
281
|
+
* data: {
|
|
282
|
+
* first_name: 'John',
|
|
283
|
+
* age: 27,
|
|
284
|
+
* }
|
|
285
|
+
* }
|
|
286
|
+
* }
|
|
287
|
+
* )
|
|
288
|
+
* ```
|
|
289
|
+
*
|
|
290
|
+
* @exampleDescription Sign up with a redirect URL
|
|
291
|
+
* - See [redirect URLs and wildcards](/docs/guides/auth/redirect-urls#use-wildcards-in-redirect-urls) to add additional redirect URLs to your project.
|
|
292
|
+
*
|
|
293
|
+
* @example Sign up with a redirect URL
|
|
294
|
+
* ```js
|
|
295
|
+
* const { data, error } = await supabase.auth.signUp(
|
|
296
|
+
* {
|
|
297
|
+
* email: 'example@email.com',
|
|
298
|
+
* password: 'example-password',
|
|
299
|
+
* options: {
|
|
300
|
+
* emailRedirectTo: 'https://example.com/welcome'
|
|
301
|
+
* }
|
|
302
|
+
* }
|
|
303
|
+
* )
|
|
304
|
+
* ```
|
|
138
305
|
*/
|
|
139
306
|
signUp(credentials: SignUpWithPasswordCredentials): Promise<AuthResponse>;
|
|
140
307
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoTrueClient.d.ts","sourceRoot":"","sources":["../../src/GoTrueClient.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAU7C,OAAO,EACL,SAAS,EAcV,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,KAAK,EAMN,MAAM,aAAa,CAAA;AACpB,OAAO,EAGL,QAAQ,EAgBT,MAAM,eAAe,CAAA;AAOtB,OAAO,KAAK,EACV,eAAe,EAEf,YAAY,EAcZ,eAAe,EACf,YAAY,EAEZ,iBAAiB,EACjB,yBAAyB,EACzB,sBAAsB,EAItB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,UAAU,EACV,QAAQ,EAgBR,aAAa,EACb,kBAAkB,EAOlB,YAAY,EACZ,OAAO,EACP,4BAA4B,EAC5B,4BAA4B,EAC5B,0BAA0B,EAC1B,6B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;;OAIG;YACW,uBAAuB;IA+BrC;;OAEG;YACW,oBAAoB;IAwClC;;;;;OAKG;YACW,kBAAkB;YAwClB,SAAS;IAqBvB;;OAEG;YACW,OAAO;IA4CrB;;OAEG;YACW,OAAO;IAgFrB;;OAEG;YACW,UAAU;IAsFxB;;OAEG;YACW,mBAAmB;IAoBjC;;OAEG;YACW,YAAY;IA+B1B;;OAEG;YACW,+BAA+B;IA8E7C;;;;;;;OAOG;YACW,wBAAwB;IAsCtC;;;OAGG;YACW,qBAAqB;IAiDnC;;;OAGG;YACW,kBAAkB;IAiDhC;;;OAGG;YACW,gBAAgB;IA+B9B;;;OAGG;YACW,iBAAiB;YAmCjB,QAAQ;IAsCtB;;;;;;;;;;;;;;;OAeG;IACG,SAAS,CACb,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,GAAE;QACP;;WAEG;QACH,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QAEZ,uFAAuF;QACvF,YAAY,CAAC,EAAE,OAAO,CAAA;QAEtB,+GAA+G;QAC/G,IAAI,CAAC,EAAE;YAAE,IAAI,EAAE,GAAG,EAAE,CAAA;SAAE,CAAA;KAClB,GACL,OAAO,CACN;QACE,IAAI,EAAE;YAAE,MAAM,EAAE,UAAU,CAAC;YAAC,MAAM,EAAE,SAAS,CAAC;YAAC,SAAS,EAAE,UAAU,CAAA;SAAE,CAAA;QACtE,KAAK,EAAE,IAAI,CAAA;KACZ,GACD;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,GAChC;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,IAAI,CAAA;KAAE,CAC9B;CAmFF"}
|
|
@@ -368,6 +368,173 @@ class GoTrueClient {
|
|
|
368
368
|
*
|
|
369
369
|
* @returns A logged-in session if the server has "autoconfirm" ON
|
|
370
370
|
* @returns A user if the server has "autoconfirm" OFF
|
|
371
|
+
*
|
|
372
|
+
* @category Auth
|
|
373
|
+
*
|
|
374
|
+
* @remarks
|
|
375
|
+
* - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](/dashboard/project/_/auth/providers).
|
|
376
|
+
* - **Confirm email** determines if users need to confirm their email address after signing up.
|
|
377
|
+
* - If **Confirm email** is enabled, a `user` is returned but `session` is null.
|
|
378
|
+
* - If **Confirm email** is disabled, both a `user` and a `session` are returned.
|
|
379
|
+
* - When the user confirms their email address, they are redirected to the [`SITE_URL`](/docs/guides/auth/redirect-urls#use-wildcards-in-redirect-urls) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](/dashboard/project/_/auth/url-configuration).
|
|
380
|
+
* - If signUp() is called for an existing confirmed user:
|
|
381
|
+
* - When both **Confirm email** and **Confirm phone** (even when phone provider is disabled) are enabled in [your project](/dashboard/project/_/auth/providers), an obfuscated/fake user object is returned.
|
|
382
|
+
* - When either **Confirm email** or **Confirm phone** (even when phone provider is disabled) is disabled, the error message, `User already registered` is returned.
|
|
383
|
+
* - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser).
|
|
384
|
+
*
|
|
385
|
+
* @example Sign up with an email and password
|
|
386
|
+
* ```js
|
|
387
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
388
|
+
* email: 'example@email.com',
|
|
389
|
+
* password: 'example-password',
|
|
390
|
+
* })
|
|
391
|
+
* ```
|
|
392
|
+
*
|
|
393
|
+
* @exampleResponse Sign up with an email and password
|
|
394
|
+
* ```json
|
|
395
|
+
* // Some fields may be null if "confirm email" is enabled.
|
|
396
|
+
* {
|
|
397
|
+
* "data": {
|
|
398
|
+
* "user": {
|
|
399
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
400
|
+
* "aud": "authenticated",
|
|
401
|
+
* "role": "authenticated",
|
|
402
|
+
* "email": "example@email.com",
|
|
403
|
+
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
404
|
+
* "phone": "",
|
|
405
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
406
|
+
* "app_metadata": {
|
|
407
|
+
* "provider": "email",
|
|
408
|
+
* "providers": [
|
|
409
|
+
* "email"
|
|
410
|
+
* ]
|
|
411
|
+
* },
|
|
412
|
+
* "user_metadata": {},
|
|
413
|
+
* "identities": [
|
|
414
|
+
* {
|
|
415
|
+
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
416
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
417
|
+
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
418
|
+
* "identity_data": {
|
|
419
|
+
* "email": "example@email.com",
|
|
420
|
+
* "email_verified": false,
|
|
421
|
+
* "phone_verified": false,
|
|
422
|
+
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
423
|
+
* },
|
|
424
|
+
* "provider": "email",
|
|
425
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
426
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
427
|
+
* "updated_at": "2024-01-01T00:00:00Z",
|
|
428
|
+
* "email": "example@email.com"
|
|
429
|
+
* }
|
|
430
|
+
* ],
|
|
431
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
432
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
433
|
+
* },
|
|
434
|
+
* "session": {
|
|
435
|
+
* "access_token": "<ACCESS_TOKEN>",
|
|
436
|
+
* "token_type": "bearer",
|
|
437
|
+
* "expires_in": 3600,
|
|
438
|
+
* "expires_at": 1700000000,
|
|
439
|
+
* "refresh_token": "<REFRESH_TOKEN>",
|
|
440
|
+
* "user": {
|
|
441
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
442
|
+
* "aud": "authenticated",
|
|
443
|
+
* "role": "authenticated",
|
|
444
|
+
* "email": "example@email.com",
|
|
445
|
+
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
446
|
+
* "phone": "",
|
|
447
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
448
|
+
* "app_metadata": {
|
|
449
|
+
* "provider": "email",
|
|
450
|
+
* "providers": [
|
|
451
|
+
* "email"
|
|
452
|
+
* ]
|
|
453
|
+
* },
|
|
454
|
+
* "user_metadata": {},
|
|
455
|
+
* "identities": [
|
|
456
|
+
* {
|
|
457
|
+
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
458
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
459
|
+
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
460
|
+
* "identity_data": {
|
|
461
|
+
* "email": "example@email.com",
|
|
462
|
+
* "email_verified": false,
|
|
463
|
+
* "phone_verified": false,
|
|
464
|
+
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
465
|
+
* },
|
|
466
|
+
* "provider": "email",
|
|
467
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
468
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
469
|
+
* "updated_at": "2024-01-01T00:00:00Z",
|
|
470
|
+
* "email": "example@email.com"
|
|
471
|
+
* }
|
|
472
|
+
* ],
|
|
473
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
474
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
475
|
+
* }
|
|
476
|
+
* }
|
|
477
|
+
* },
|
|
478
|
+
* "error": null
|
|
479
|
+
* }
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* @example Sign up with a phone number and password (SMS)
|
|
483
|
+
* ```js
|
|
484
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
485
|
+
* phone: '123456789',
|
|
486
|
+
* password: 'example-password',
|
|
487
|
+
* options: {
|
|
488
|
+
* channel: 'sms'
|
|
489
|
+
* }
|
|
490
|
+
* })
|
|
491
|
+
* ```
|
|
492
|
+
*
|
|
493
|
+
* @exampleDescription Sign up with a phone number and password (whatsapp)
|
|
494
|
+
* The user will be sent a WhatsApp message which contains a OTP. By default, a given user can only request a OTP once every 60 seconds. Note that a user will need to have a valid WhatsApp account that is linked to Twilio in order to use this feature.
|
|
495
|
+
*
|
|
496
|
+
* @example Sign up with a phone number and password (whatsapp)
|
|
497
|
+
* ```js
|
|
498
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
499
|
+
* phone: '123456789',
|
|
500
|
+
* password: 'example-password',
|
|
501
|
+
* options: {
|
|
502
|
+
* channel: 'whatsapp'
|
|
503
|
+
* }
|
|
504
|
+
* })
|
|
505
|
+
* ```
|
|
506
|
+
*
|
|
507
|
+
* @example Sign up with additional user metadata
|
|
508
|
+
* ```js
|
|
509
|
+
* const { data, error } = await supabase.auth.signUp(
|
|
510
|
+
* {
|
|
511
|
+
* email: 'example@email.com',
|
|
512
|
+
* password: 'example-password',
|
|
513
|
+
* options: {
|
|
514
|
+
* data: {
|
|
515
|
+
* first_name: 'John',
|
|
516
|
+
* age: 27,
|
|
517
|
+
* }
|
|
518
|
+
* }
|
|
519
|
+
* }
|
|
520
|
+
* )
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
* @exampleDescription Sign up with a redirect URL
|
|
524
|
+
* - See [redirect URLs and wildcards](/docs/guides/auth/redirect-urls#use-wildcards-in-redirect-urls) to add additional redirect URLs to your project.
|
|
525
|
+
*
|
|
526
|
+
* @example Sign up with a redirect URL
|
|
527
|
+
* ```js
|
|
528
|
+
* const { data, error } = await supabase.auth.signUp(
|
|
529
|
+
* {
|
|
530
|
+
* email: 'example@email.com',
|
|
531
|
+
* password: 'example-password',
|
|
532
|
+
* options: {
|
|
533
|
+
* emailRedirectTo: 'https://example.com/welcome'
|
|
534
|
+
* }
|
|
535
|
+
* }
|
|
536
|
+
* )
|
|
537
|
+
* ```
|
|
371
538
|
*/
|
|
372
539
|
async signUp(credentials) {
|
|
373
540
|
var _a, _b, _c;
|