Update auth0-js to v8.6 (#16704)

* Update auth0-js to v8.6

* remove redundant @method in JSDoc

* Fix auth0-js-test
This commit is contained in:
Adrian Chia
2017-06-02 16:58:35 -07:00
committed by Andy
parent 47c53f1ca2
commit 524b072a5a
2 changed files with 310 additions and 100 deletions
+76 -9
View File
@@ -12,7 +12,64 @@ webAuth.authorize({
redirectUri: 'https://example.com/auth/callback'
});
webAuth.parseHash(window.location.hash, (err, authResult) => {
webAuth.parseHash((err, authResult) => {
if (err) {
return console.log(err);
}
// The contents of authResult depend on which authentication parameters were used.
// It can include the following:
// authResult.accessToken - access token for the API specified by `audience`
// authResult.expiresIn - string with the access token's expiration time in seconds
// authResult.idToken - ID token JWT containing user profile information
webAuth.client.userInfo(authResult.accessToken, (err, user) => {
// Now you have the user's information
});
});
webAuth.parseHash((err, authResult) => {
if (err) {
return console.log(err);
}
// The contents of authResult depend on which authentication parameters were used.
// It can include the following:
// authResult.accessToken - access token for the API specified by `audience`
// authResult.expiresIn - string with the access token's expiration time in seconds
// authResult.idToken - ID token JWT containing user profile information
webAuth.client.userInfo(authResult.accessToken, (err, user) => {
// Now you have the user's information
});
});
webAuth.parseHash(
{
nonce: 'asfd',
hash: '#access_token=VjubIMBmpgQ2W2&id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlF6RTROMFpCTTBWRFF6RTJSVVUwTnpJMVF6WTFNelE0UVRrMU16QXdNRUk0UkRneE56RTRSZyJ9.eyJpc3MiOiJodHRwczovL3dwdGVzdC5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8NTVkNDhjNTdkNWIwYWQwMjIzYzQwOGQ3IiwiYXVkIjoiZ1lTTmxVNFlDNFYxWVBkcXE4elBRY3VwNnJKdzFNYnQiLCJleHAiOjE0ODI5NjkwMzEsImlhdCI6MTQ4MjkzMzAzMSwibm9uY2UiOiJhc2ZkIn0.PPoh-pITcZ8qbF5l5rMZwXiwk5efbESuqZ0IfMUcamB6jdgLwTxq-HpOT_x5q6-sO1PBHchpSo1WHeDYMlRrOFd9bh741sUuBuXdPQZ3Zb0i2sNOAC2RFB1E11mZn7uNvVPGdPTg-Y5xppz30GSXoOJLbeBszfrVDCmPhpHKGGMPL1N6HV-3EEF77L34YNAi2JQ-b70nFK_dnYmmv0cYTGUxtGTHkl64UEDLi3u7bV-kbGky3iOOCzXKzDDY6BBKpCRTc2KlbrkO2A2PuDn27WVv1QCNEFHvJN7HxiDDzXOsaUmjrQ3sfrHhzD7S9BcCRkekRfD9g95SKD5J0Fj8NA&token_type=Bearer&state=theState&refresh_token=kajshdgfkasdjhgfas&scope=foo'
},
(err, authResult) => {
if (err) {
return console.log(err);
}
// The contents of authResult depend on which authentication parameters were used.
// It can include the following:
// authResult.accessToken - access token for the API specified by `audience`
// authResult.expiresIn - string with the access token's expiration time in seconds
// authResult.idToken - ID token JWT containing user profile information
webAuth.client.userInfo(authResult.accessToken, (err, user) => {
// Now you have the user's information
});
});
webAuth.parseHash(
{
nonce: 'asfd'
},
(err, authResult) => {
if (err) {
return console.log(err);
}
@@ -29,14 +86,21 @@ webAuth.parseHash(window.location.hash, (err, authResult) => {
});
webAuth.renewAuth({
audience: 'https://mystore.com/api/v2',
scope: 'read:order write:order',
redirectUri: 'https://example.com/auth/silent-callback',
}, function (err, authResult) {
// Renewed tokens or error
});
// this will use postMessage to comunicate between the silent callback
// and the SPA. When false the SDK will attempt to parse the url hash
// should ignore the url hash and no extra behaviour is needed.
usePostMessage: true
webAuth.renewAuth({
nonce: '123',
state: '456'
}, function (err, authResult) {
// Renewed tokens or error
});
webAuth.renewAuth({
nonce: '123',
state: '456',
postMessageDataType: 'auth0:silent-authentication'
}, function (err, authResult) {
// Renewed tokens or error
});
@@ -90,6 +154,9 @@ webAuth.popup.signupAndLogin({}, (err, data) => {
// do something with data
});
webAuth.login({username: 'bar', password: 'foo'}, (err, data) => {});
webAuth.crossOriginAuthenticationCallback();
let authentication = new auth0.Authentication({
domain: 'me.auth0.com',
@@ -150,7 +217,7 @@ authentication.dbConnection.signup({connection: 'bla', email: 'blabla', password
authentication.dbConnection.changePassword({connection: 'bla', email: 'blabla', password: '123456'}, () => {});
authentication.passwordless.start({ connection: 'bla', send: 'blabla' }, () => {});
authentication.passwordless.verify({ connection: 'bla', send: 'link', verificationCode: 'asdfasd', email: 'me@example.com' }, () => {});
authentication.passwordless.verify({ connection: 'bla', verificationCode: 'asdfasd', email: 'me@example.com' }, () => {});
authentication.loginWithResourceOwner({
username: 'the username',
+234 -91
View File
@@ -1,4 +1,4 @@
// Type definitions for Auth0.js 8.3
// Type definitions for Auth0.js 8.6
// Project: https://github.com/auth0/auth0.js
// Definitions by: Adrian Chia <https://github.com/adrianchia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -15,7 +15,6 @@ export class Authentication {
/**
* Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction
*
* @method buildAuthorizeUrl
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
buildAuthorizeUrl(options: any): string;
@@ -23,34 +22,32 @@ export class Authentication {
/**
* Builds and returns the Logout url in order to initialize a new authN/authZ transaction
*
* @method buildLogoutUrl
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
*/
buildLogoutUrl(options?: any): string;
buildLogoutUrl(options?: LogoutOptions): string;
/**
* Makes a call to the `oauth/token` endpoint with `password` grant type
*
* @method loginWithDefaultDirectory
* @param {Object} options: https://auth0.com/docs/api-auth/grant/password
* @param {DefaultDirectoryLoginOptions} options: https://auth0.com/docs/api-auth/grant/password
* @param {Function} callback
*/
loginWithDefaultDirectory(options: any, callback: Auth0Callback<any>): void;
loginWithDefaultDirectory(options: DefaultDirectoryLoginOptions, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `/ro` endpoint
* @param {any} options
* @param {ResourceOwnerLoginOptions} options
* @param {Function} callback
* @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead.
*/
loginWithResourceOwner(options: any, callback: Auth0Callback<any>): void;
loginWithResourceOwner(options: ResourceOwnerLoginOptions, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `oauth/token` endpoint with `password-realm` grant type
* @param {any} options
* @param {DefaultLoginOptions} options
* @param {Function} callback
*/
login(options: any, callback: Auth0Callback<any>): void;
login(options: DefaultLoginOptions, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `oauth/token` endpoint
@@ -62,7 +59,6 @@ export class Authentication {
/**
* Makes a call to the `/ssodata` endpoint
*
* @method getSSOData
* @param {Function} callback
*/
getSSOData(callback?: Auth0Callback<any>): void;
@@ -70,7 +66,6 @@ export class Authentication {
/**
* Makes a call to the `/ssodata` endpoint
*
* @method getSSOData
* @param {Boolean} withActiveDirectories
* @param {Function} callback
*/
@@ -79,25 +74,22 @@ export class Authentication {
/**
* Makes a call to the `/userinfo` endpoint and returns the user profile
*
* @method userInfo
* @param {String} accessToken
* @param {Function} callback
*/
userInfo(token: string, callback: Auth0Callback<Auth0UserProfile>): void;
userInfo(accessToken: string, callback: Auth0Callback<Auth0UserProfile>): void;
/**
* Makes a call to the `/delegation` endpoint
*
* @method delegation
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation
* @param {DelegationOptions} options: https://auth0.com/docs/api/authentication#!#post--delegation
* @param {Function} callback
*/
delegation(options: any, callback: Auth0Callback<Auth0DelegationToken>): any;
delegation(options: DelegationOptions, callback: Auth0Callback<Auth0DelegationToken>): any;
/**
* Fetches the user country based on the ip.
*
* @method getUserCountry
* @param {Function} callback
*/
getUserCountry(callback: Auth0Callback<{ countryCode: string }>): void;
@@ -109,16 +101,14 @@ export class PasswordlessAuthentication {
/**
* Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction
*
* @method buildVerifyUrl
* @param {Object} options
* @param {PasswordlessVerifyOptions} options
* @param {Function} callback
*/
buildVerifyUrl(options: any): string;
buildVerifyUrl(options: PasswordlessVerifyOptions): string;
/**
* Initializes a new passwordless authN/authZ transaction
*
* @method start
* @param {Object} options: https://auth0.com/docs/api/authentication#passwordless
* @param {Function} callback
*/
@@ -127,11 +117,10 @@ export class PasswordlessAuthentication {
/**
* Verifies the passwordless TOTP and returns an error if any.
*
* @method buildVerifyUrl
* @param {Object} options
* @param {PasswordlessVerifyOptions} options
* @param {Function} callback
*/
verify(options: any, callback: Auth0Callback<any>): void;
verify(options: PasswordlessVerifyOptions, callback: Auth0Callback<any>): void;
}
export class DBConnection {
@@ -140,17 +129,15 @@ export class DBConnection {
/**
* Signup a new user
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {DbSignUpOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} calback
*/
signup(options: any, callback: Auth0Callback<any>): void;
signup(options: DbSignUpOptions, callback: Auth0Callback<any>): void;
/**
* Initializes the change password flow
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {ChangePasswordOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {Function} callback
*/
changePassword(options: ChangePasswordOptions, callback: Auth0Callback<any>): void;
@@ -162,7 +149,6 @@ export class Management {
/**
* Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id
*
* @method getUser
* @param {String} userId
* @param {Function} callback
*/
@@ -172,7 +158,6 @@ export class Management {
* Updates the user metdata. It will patch the user metdata with the attributes sent.
* https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id
*
* @method patchUserMetadata
* @param {String} userId
* @param {Object} userMetadata
* @param {Function} callback
@@ -182,7 +167,6 @@ export class Management {
/**
* Link two users. https://auth0.com/docs/api/management/v2#!/Users/post_identities
*
* @method linkUser
* @param {String} userId
* @param {String} secondaryUserToken
* @param {Function} callback
@@ -195,14 +179,14 @@ export class WebAuth {
client: Authentication;
popup: Popup;
redirect: Redirect;
crossOriginAuthentication: CrossOriginAuthentication;
/**
* Redirects to the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
*
* @method authorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
* @param {AuthorizeOptions} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
authorize(options: any): void;
authorize(options: AuthorizeOptions): void;
/**
* Parse the url hash and extract the returned tokens depending on the transaction.
@@ -211,82 +195,99 @@ export class WebAuth {
* by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be
* accepted.
*
* @method parseHash
* @param {Object} options:
* @param {String} options._idTokenVerification [OPTIONAL] Default: true
* @param {String} options.state [OPTIONAL] to verify the response
* @param {String} options.nonce [OPTIONAL] to verify the id_token
* @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash
* @param {ParseHashOptions} options
* @param {Function} callback: any(err, token_payload)
*/
parseHash(options: any, callback: Auth0Callback<Auth0DecodedHash>): void;
parseHash(callback: Auth0Callback<Auth0DecodedHash>): void;
/**
* Parse the url hash and extract the returned tokens depending on the transaction.
*
* Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed
* by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be
* accepted.
*
* @param {ParseHashOptions} options
* @param {Function} callback: any(err, token_payload)
*/
parseHash(options: ParseHashOptions, callback: Auth0Callback<Auth0DecodedHash>): void;
/**
* Decodes the id_token and verifies the nonce.
*
* @method validateToken
* @param {String} token
* @param {String} state
* @param {String} nonce
* @param {Function} callback: function(err, {payload, transaction})
*/
validateToken(token: string, state: string, nonce: string, callback: Auth0Callback<any>): void;
validateToken(token: string, nonce: string, callback: Auth0Callback<any>): void;
/**
* Executes a silent authentication transaction under the hood in order to fetch a new token.
* Executes a silent authentication transaction under the hood in order to fetch a new tokens for the current session.
* This method requires that all Auth is performed with {@link authorize}
* Watch out! If you're not using the hosted login page to do social logins, you have to use your own [social connection keys](https://manage.auth0.com/#/connections/social). If you use Auth0's dev keys, you'll always get `login_required` as an error when calling this method.
*
* @method renewAuth
* @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint
* @param {RenewAuthOptions} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint
* @param {Function} callback
*/
renewAuth(options: any, callback: Auth0Callback<any>): void;
renewAuth(options: RenewAuthOptions, callback: Auth0Callback<any>): void;
/**
* Initialices a change password transaction
*
* @method changePassword
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {ChangePasswordOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {Function} callback
*/
changePassword(options: any, callback: Auth0Callback<any>): void;
changePassword(options: ChangePasswordOptions, callback: Auth0Callback<any>): void;
/**
* Signs up a new user
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {DbSignUpOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signup(options: any, callback: Auth0Callback<any>): void;
signup(options: DbSignUpOptions, callback: Auth0Callback<any>): void;
/**
* Signs up a new user, automatically logs the user in after the signup and returns the user token.
* The login will be done using /oauth/token with password-realm grant type.
*
* @method signupAndAuthorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {DbSignUpOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signupAndAuthorize(options: any, callback: Auth0Callback<any>): void;
signupAndAuthorize(options: DbSignUpOptions, callback: Auth0Callback<any>): void;
/**
* Redirects to the auth0 logout page
* Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either `username` or `email` to identify the user, but `username` will take precedence over `email`.
* This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor.
*
* @method logout
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
* @param {CrossOriginLoginOptions} options options used in the {@link authorize} call after the login_ticket is acquired
* @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`.
*/
logout(options: any): void;
login(options: CrossOriginLoginOptions, callback: Auth0Callback<any>): void;
/**
* Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url.
*
*/
crossOriginAuthenticationCallback(): void;
/**
* Redirects to the auth0 logout endpoint
*
* If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list:
*
* - If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the client level (see Setting Allowed Logout URLs at the App Level).
* - If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level).
*
* @param {LogoutOptions} options
* @see {@link https://auth0.com/docs/api/authentication#logout}
*/
logout(options: LogoutOptions): void;
/**
* Initialices a passwordless authentication transaction
*
* @method passwordlessStart
* @param {Object} options: https://auth0.com/docs/api/authentication#passwordless
* @param {Object} options.send: `link` or `code`
* @param {Object} options.phoneNumber: send should be code and email not set
* @param {Object} options.email: phoneNumber should be ignored
* @param {Object} options.connection
* @param {Object} options.authParams
* @param {PasswordlessStartOptions} options: https://auth0.com/docs/api/authentication#passwordless
* @param {Function} callback
*/
passwordlessStart(options: PasswordlessStartOptions, callback: Auth0Callback<any>): void;
@@ -295,27 +296,28 @@ export class WebAuth {
* Verifies the passwordless TOTP and redirects to finish the passwordless transaction
*
* @method passwordlessVerify
* @param {Object} options:
* @param {Object} options.type: `sms` or `email`
* @param {Object} options.phoneNumber: only if type = sms
* @param {Object} options.email: only if type = email
* @param {Object} options.connection: the connection name
* @param {Object} options.verificationCode: the TOTP code
* @param {PasswordlessVerifyOptions} options:
* @param {Function} callback
*/
passwordlessVerify(options: any, callback: Auth0Callback<any>): void;
passwordlessVerify(options: PasswordlessVerifyOptions, callback: Auth0Callback<any>): void;
}
export class Redirect {
constructor(client: any, options: any);
/**
* Initializes the legacy Lock login flow in a popup
* Performs authentication with username/email and password with a database connection
*
* This method is not compatible with API Auth so if you need to fetch API tokens with audience
* you should use {@link authorize} or {@link login}.
*
* @method loginWithCredentials
* @param {Object} options
* @param {Function} callback
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
* @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response
* @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token`
* @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment`
* @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email`
* @param {credentialsCallback} cb
*/
loginWithCredentials(options: any, callback: Auth0Callback<any>): void;
@@ -323,8 +325,11 @@ export class Redirect {
* Signs up a new user and automatically logs the user in after the signup.
*
* @method signupAndLogin
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
* @param {Object} options
* @param {String} options.email user email address
* @param {String} options.password user password
* @param {String} options.connection name of the connection where the user will be created
* @param {credentialsCallback} cb
*/
signupAndLogin(options: any, callback: Auth0Callback<any>): void;
}
@@ -348,21 +353,51 @@ export class Popup {
preload(options: any): any;
/**
* Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
* Handles the popup logic for the callback page.
*
* @method callback
* @param {Object} options
* @param {String} options.hash the url hash. If not provided it will extract from window.location.hash
* @param {String} [options.state] value originally sent in `state` parameter to {@link authorize} to mitigate XSRF
* @param {String} [options.nonce] value originally sent in `nonce` parameter to {@link authorize} to prevent replay attacks
* @param {String} [options._idTokenVerification] makes parseHash perform or skip `id_token` verification. We **strongly** recommend validating the `id_token` yourself if you disable the verification.
* @see {@link parseHash}
*/
callback(options: any): void;
/**
* Shows inside a new window the hosted login page (`/authorize`) in order to start a new authN/authZ transaction and post its result using `postMessage`.
*
* @method authorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
* @param {Function} callback
* @param {Object} options
* @param {String} [options.domain] your Auth0 domain
* @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard
* @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response
* @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}
* @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}
* @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state}
* @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce}
* @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`
* @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth
* @param {Boolean} [options.owp] determines if Auth0 should render the relay page or not and the caller is responsible of handling the response.
* @param {authorizeCallback} cb
* @see {@link https://auth0.com/docs/api/authentication#authorize-client}
*/
authorize(options: any, callback: Auth0Callback<any>): void;
/**
* Initializes the legacy Lock login flow in a popup
* Performs authentication with username/email and password with a database connection inside a new window
*
* This method is not compatible with API Auth so if you need to fetch API tokens with audience
* you should use {@link authorize} or {@link login}.
*
* @method loginWithCredentials
* @param {Object} options
* @param {Function} callback
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
* @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response
* @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token`
* @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment`
* @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email`
* @param {credentialsCallback} cb
*/
loginWithCredentials(options: any, callback: Auth0Callback<any>): void;
@@ -383,13 +418,38 @@ export class Popup {
/**
* Signs up a new user and automatically logs the user in after the signup.
*
* This method is not compatible with API Auth so if you need to fetch API tokens with audience
* you should use {@link authorize} or {@link signupAndAuthorize}.
*
* @method signupAndLogin
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
* @param {Object} options
* @param {String} options.email user email address
* @param {String} options.password user password
* @param {String} options.connection name of the connection where the user will be created
* @param {credentialsCallback} cb
*/
signupAndLogin(options: any, callback: Auth0Callback<any>): void;
}
export class CrossOriginAuthentication {
constructor(webAuth: any, options: any);
/**
* Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either `username` or `email` to identify the user, but `username` will take precedence over `email`.
* This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor.
*
* @param {CrossOriginLoginOptions} options options used in the {@link authorize} call after the login_ticket is acquired
* @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`.
*/
login(options: CrossOriginLoginOptions, callback: Auth0Callback<any>): void;
/**
* Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url.
*
*/
callback(): void;
}
type Auth0Callback<T> = (error: null | Auth0Error, result: T) => void;
interface ManagementOptions {
@@ -472,6 +532,7 @@ interface PasswordlessVerifyOptions {
verificationCode: string;
phoneNumber?: string;
email?: string;
send?: string;
}
interface Auth0UserProfile {
@@ -514,3 +575,85 @@ interface Auth0Identity {
provider: string;
user_id: string;
}
interface LoginOptions {
username: string;
password: string;
scope?: string;
}
interface DefaultLoginOptions extends LoginOptions {
audience?: string;
realm: string;
}
interface DefaultDirectoryLoginOptions extends LoginOptions {
audience?: string;
}
interface ResourceOwnerLoginOptions extends LoginOptions {
connection: string;
device?: string;
}
interface CrossOriginLoginOptions {
username?: string;
email?: string;
password: string;
realm?: string;
}
interface LogoutOptions {
clientID?: string;
returnTo?: string;
federated?: boolean;
}
interface DelegationOptions {
client_id?: string;
grant_type: string;
id_token?: string;
refresh_token?: string;
target?: string;
scope?: string;
api_type?: string;
}
interface DbSignUpOptions {
email: string;
password: string;
connection: string;
scope?: string;
}
interface ParseHashOptions {
hash?: string;
state?: string;
nonce?: string;
_idTokenVerification?: boolean;
}
interface RenewAuthOptions {
domain?: string;
clientID?: string;
redirectUri?: string;
responseType?: string;
responseMode?: string;
state?: string;
nonce?: string;
scope?: string;
audience?: string;
postMessageDataType?: string;
}
interface AuthorizeOptions {
domain?: string;
clientID?: string;
redirectUri: string;
responseType: string;
responseMode?: string;
state?: string;
nonce?: string;
scope?: string;
audience?: string;
}