mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
feat(auth0-js): correct dbconnection signup details (#41847)
- property name (`userMetadata`) - missing props - props documentation - typed signup callback results options https://git.io/Jvqte Thanks!
This commit is contained in:
parent
f0232f626b
commit
3061712f65
@ -150,7 +150,7 @@ webAuth.signupAndAuthorize({
|
||||
password: '123456',
|
||||
scope: 'openid',
|
||||
username: "blabla",
|
||||
user_metadata: {
|
||||
userMetadata: {
|
||||
foo: 'bar'
|
||||
}
|
||||
}, (err, data) => {});
|
||||
@ -263,9 +263,40 @@ authentication.getUserCountry((err, data) => {});
|
||||
authentication.getSSOData();
|
||||
authentication.getSSOData(true, (err, data) => {});
|
||||
|
||||
// $ExpectError
|
||||
authentication.dbConnection.signup();
|
||||
// $ExpectError
|
||||
authentication.dbConnection.signup({});
|
||||
// $ExpectError
|
||||
authentication.dbConnection.signup({ connection: 'bla', email: 'blabla' });
|
||||
// $ExpectError
|
||||
authentication.dbConnection.signup({ connection: 'bla', email: 'blabla', password: '123456' });
|
||||
authentication.dbConnection.signup(
|
||||
{ connection: 'bla', email: 'blabla', password: '123456', username: 'blabla' },
|
||||
() => {}
|
||||
(auth0Error, results) => {
|
||||
if (auth0Error) {
|
||||
const { error, errorDescription } = auth0Error;
|
||||
}
|
||||
if (results) {
|
||||
const { email, emailVerified } = results;
|
||||
}
|
||||
},
|
||||
);
|
||||
authentication.dbConnection.signup(
|
||||
{
|
||||
email: 'the email',
|
||||
password: 'the password',
|
||||
connection: 'the_connection',
|
||||
userMetadata: {
|
||||
firstName: 'Toon',
|
||||
lastName: 'De Coninck',
|
||||
last_location: 'Mexico',
|
||||
},
|
||||
},
|
||||
(err, data) => {
|
||||
console.assert(err === null);
|
||||
console.assert(data.email !== null);
|
||||
},
|
||||
);
|
||||
authentication.dbConnection.changePassword({connection: 'bla', email: 'blabla'}, () => {});
|
||||
|
||||
|
||||
21
types/auth0-js/index.d.ts
vendored
21
types/auth0-js/index.d.ts
vendored
@ -113,11 +113,10 @@ export class DBConnection {
|
||||
constructor(request: any, option: any);
|
||||
|
||||
/**
|
||||
* Signup a new user
|
||||
*
|
||||
* @param options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* Creates a new user in a Auth0 Database connection
|
||||
* @param options https://auth0.com/docs/api/authentication#signup
|
||||
*/
|
||||
signup(options: DbSignUpOptions, callback: Auth0Callback<any>): void;
|
||||
signup(options: DbSignUpOptions, callback: Auth0Callback<DbSignUpResults>): void;
|
||||
|
||||
/**
|
||||
* Initializes the change password flow
|
||||
@ -834,13 +833,25 @@ export interface DelegationOptions {
|
||||
}
|
||||
|
||||
export interface DbSignUpOptions {
|
||||
/** user email address */
|
||||
email: string;
|
||||
/** user password */
|
||||
password: string;
|
||||
/** name of the connection where the user will be created */
|
||||
connection: string;
|
||||
/** User desired username. Required if you use a database connection and you have enabled `Requires Username` */
|
||||
username?: string;
|
||||
scope?: string;
|
||||
user_metadata?: any;
|
||||
/** additional signup attributes used for creating the user. Will be stored in `user_metadata` */
|
||||
userMetadata?: any;
|
||||
}
|
||||
|
||||
/** result of the signup request */
|
||||
export interface DbSignUpResults {
|
||||
/** user's email */
|
||||
email: string;
|
||||
/** if the user's email was verified */
|
||||
emailVerified: boolean;
|
||||
}
|
||||
|
||||
export interface ParseHashOptions {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user