@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"}
|
|
@@ -365,6 +365,173 @@ class GoTrueClient {
|
|
|
365
365
|
*
|
|
366
366
|
* @returns A logged-in session if the server has "autoconfirm" ON
|
|
367
367
|
* @returns A user if the server has "autoconfirm" OFF
|
|
368
|
+
*
|
|
369
|
+
* @category Auth
|
|
370
|
+
*
|
|
371
|
+
* @remarks
|
|
372
|
+
* - 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).
|
|
373
|
+
* - **Confirm email** determines if users need to confirm their email address after signing up.
|
|
374
|
+
* - If **Confirm email** is enabled, a `user` is returned but `session` is null.
|
|
375
|
+
* - If **Confirm email** is disabled, both a `user` and a `session` are returned.
|
|
376
|
+
* - 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).
|
|
377
|
+
* - If signUp() is called for an existing confirmed user:
|
|
378
|
+
* - 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.
|
|
379
|
+
* - When either **Confirm email** or **Confirm phone** (even when phone provider is disabled) is disabled, the error message, `User already registered` is returned.
|
|
380
|
+
* - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser).
|
|
381
|
+
*
|
|
382
|
+
* @example Sign up with an email and password
|
|
383
|
+
* ```js
|
|
384
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
385
|
+
* email: 'example@email.com',
|
|
386
|
+
* password: 'example-password',
|
|
387
|
+
* })
|
|
388
|
+
* ```
|
|
389
|
+
*
|
|
390
|
+
* @exampleResponse Sign up with an email and password
|
|
391
|
+
* ```json
|
|
392
|
+
* // Some fields may be null if "confirm email" is enabled.
|
|
393
|
+
* {
|
|
394
|
+
* "data": {
|
|
395
|
+
* "user": {
|
|
396
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
397
|
+
* "aud": "authenticated",
|
|
398
|
+
* "role": "authenticated",
|
|
399
|
+
* "email": "example@email.com",
|
|
400
|
+
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
401
|
+
* "phone": "",
|
|
402
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
403
|
+
* "app_metadata": {
|
|
404
|
+
* "provider": "email",
|
|
405
|
+
* "providers": [
|
|
406
|
+
* "email"
|
|
407
|
+
* ]
|
|
408
|
+
* },
|
|
409
|
+
* "user_metadata": {},
|
|
410
|
+
* "identities": [
|
|
411
|
+
* {
|
|
412
|
+
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
413
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
414
|
+
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
415
|
+
* "identity_data": {
|
|
416
|
+
* "email": "example@email.com",
|
|
417
|
+
* "email_verified": false,
|
|
418
|
+
* "phone_verified": false,
|
|
419
|
+
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
420
|
+
* },
|
|
421
|
+
* "provider": "email",
|
|
422
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
423
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
424
|
+
* "updated_at": "2024-01-01T00:00:00Z",
|
|
425
|
+
* "email": "example@email.com"
|
|
426
|
+
* }
|
|
427
|
+
* ],
|
|
428
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
429
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
430
|
+
* },
|
|
431
|
+
* "session": {
|
|
432
|
+
* "access_token": "<ACCESS_TOKEN>",
|
|
433
|
+
* "token_type": "bearer",
|
|
434
|
+
* "expires_in": 3600,
|
|
435
|
+
* "expires_at": 1700000000,
|
|
436
|
+
* "refresh_token": "<REFRESH_TOKEN>",
|
|
437
|
+
* "user": {
|
|
438
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
439
|
+
* "aud": "authenticated",
|
|
440
|
+
* "role": "authenticated",
|
|
441
|
+
* "email": "example@email.com",
|
|
442
|
+
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
443
|
+
* "phone": "",
|
|
444
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
445
|
+
* "app_metadata": {
|
|
446
|
+
* "provider": "email",
|
|
447
|
+
* "providers": [
|
|
448
|
+
* "email"
|
|
449
|
+
* ]
|
|
450
|
+
* },
|
|
451
|
+
* "user_metadata": {},
|
|
452
|
+
* "identities": [
|
|
453
|
+
* {
|
|
454
|
+
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
455
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
456
|
+
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
457
|
+
* "identity_data": {
|
|
458
|
+
* "email": "example@email.com",
|
|
459
|
+
* "email_verified": false,
|
|
460
|
+
* "phone_verified": false,
|
|
461
|
+
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
462
|
+
* },
|
|
463
|
+
* "provider": "email",
|
|
464
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
465
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
466
|
+
* "updated_at": "2024-01-01T00:00:00Z",
|
|
467
|
+
* "email": "example@email.com"
|
|
468
|
+
* }
|
|
469
|
+
* ],
|
|
470
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
471
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
472
|
+
* }
|
|
473
|
+
* }
|
|
474
|
+
* },
|
|
475
|
+
* "error": null
|
|
476
|
+
* }
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* @example Sign up with a phone number and password (SMS)
|
|
480
|
+
* ```js
|
|
481
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
482
|
+
* phone: '123456789',
|
|
483
|
+
* password: 'example-password',
|
|
484
|
+
* options: {
|
|
485
|
+
* channel: 'sms'
|
|
486
|
+
* }
|
|
487
|
+
* })
|
|
488
|
+
* ```
|
|
489
|
+
*
|
|
490
|
+
* @exampleDescription Sign up with a phone number and password (whatsapp)
|
|
491
|
+
* 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.
|
|
492
|
+
*
|
|
493
|
+
* @example Sign up with a phone number and password (whatsapp)
|
|
494
|
+
* ```js
|
|
495
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
496
|
+
* phone: '123456789',
|
|
497
|
+
* password: 'example-password',
|
|
498
|
+
* options: {
|
|
499
|
+
* channel: 'whatsapp'
|
|
500
|
+
* }
|
|
501
|
+
* })
|
|
502
|
+
* ```
|
|
503
|
+
*
|
|
504
|
+
* @example Sign up with additional user metadata
|
|
505
|
+
* ```js
|
|
506
|
+
* const { data, error } = await supabase.auth.signUp(
|
|
507
|
+
* {
|
|
508
|
+
* email: 'example@email.com',
|
|
509
|
+
* password: 'example-password',
|
|
510
|
+
* options: {
|
|
511
|
+
* data: {
|
|
512
|
+
* first_name: 'John',
|
|
513
|
+
* age: 27,
|
|
514
|
+
* }
|
|
515
|
+
* }
|
|
516
|
+
* }
|
|
517
|
+
* )
|
|
518
|
+
* ```
|
|
519
|
+
*
|
|
520
|
+
* @exampleDescription Sign up with a redirect URL
|
|
521
|
+
* - See [redirect URLs and wildcards](/docs/guides/auth/redirect-urls#use-wildcards-in-redirect-urls) to add additional redirect URLs to your project.
|
|
522
|
+
*
|
|
523
|
+
* @example Sign up with a redirect URL
|
|
524
|
+
* ```js
|
|
525
|
+
* const { data, error } = await supabase.auth.signUp(
|
|
526
|
+
* {
|
|
527
|
+
* email: 'example@email.com',
|
|
528
|
+
* password: 'example-password',
|
|
529
|
+
* options: {
|
|
530
|
+
* emailRedirectTo: 'https://example.com/welcome'
|
|
531
|
+
* }
|
|
532
|
+
* }
|
|
533
|
+
* )
|
|
534
|
+
* ```
|
|
368
535
|
*/
|
|
369
536
|
async signUp(credentials) {
|
|
370
537
|
var _a, _b, _c;
|