Private
attemptPrivate
Optional
Readonly
busyPrivate
chosenPrivate
Readonly
clientPrivate
currentPrivate
dataPrivate
emailPrivate
Optional
emailPrivate
Readonly
inputsPrivate
Readonly
matrixPrivate
Readonly
requestPrivate
Readonly
requestPrivate
requestingPrivate
Readonly
statePrivate
submitPrivate
choosePrivate
Pick one of the flows from the returned list If a flow using all of the inputs is found, it will be returned, otherwise, null will be returned.
Only flows using all given inputs are chosen because it is likely to be surprising if the user provides a credential and it is not used. For example, for registration, this could result in the email not being used which would leave the account with no means to reset a password.
flow
If no suitable authentication flow can be found
Private
choosePrivate
doPrivate
Fire off a request, and either resolve the promise, or call startAuthStage.
new auth dict, including session id
If true, this request is a background poll, so it failing will not result in the attemptAuth promise being rejected. This can be set to true for requests that just poll to see if auth has been completed elsewhere.
Private
firstPrivate
startsubmit a new auth dict and fire off the request. This will either make attemptAuth resolve/reject, or cause the startAuthStage callback to be called for a new stage.
new auth dict to send to the server. Should
include a type
property denoting the login type, as well as any
other params for that stage.
If true, this request failing will not result in the attemptAuth promise being rejected. This can be set to true for requests that just poll to see if auth has been completed elsewhere.
Generated using TypeDoc
Abstracts the logic used to drive the interactive auth process.
Components implementing an interactive auth flow should instantiate one of these, passing in the necessary callbacks to the constructor. They should then call attemptAuth, which will return a promise which will resolve or reject when the interactive-auth process completes.
Meanwhile, calls will be made to the startAuthStage and doRequest callbacks, and information gathered from the user can be submitted with submitAuthDict.
Alias
module:interactive-auth
Param
options object
Param
A matrix client to use for the auth process
Param
error response from the last request. If null, a request will be made with no auth before starting.
Param
called with the new auth dict to submit the request. Also passes a second deprecated arg which is a flag set to true if this request is a background request. The busyChanged callback should be used instead of the background flag. Should return a promise which resolves to the successful response or rejects with a MatrixError.
Param
called whenever the interactive auth logic becomes busy submitting information provided by the user or finishes. After this has been called with true the UI should indicate that a request is in progress until it is called again with false.
Param
called when the status of the UI auth changes, ie. when the state of an auth stage changes of when the auth flow moves to a new stage. The arguments are: the login type (eg m.login.password); and an object which is either an error or an informational object specific to the login type. If the 'errcode' key is defined, the object is an error, and has keys: errcode: string, the textual error code, eg. M_UNKNOWN error: string, human readable string describing the error
Param
Inputs provided by the user and used by different stages of the auto process. The inputs provided will affect what flow is chosen.
Param
An email address. If supplied, a flow using email verification will be chosen.
Param
An ISO two letter country code. Gives the country that opts.phoneNumber should be resolved relative to.
Param
A phone number. If supplied, a flow using phone number validation will be chosen.
Param
If resuming an existing interactive auth session, the sessionId of that session.
Param
If resuming an existing interactive auth session, the client secret for that session
Param
If returning from having completed m.login.email.identity auth, the sid for the email verification session.
Param
A function that takes the email address (string), clientSecret (string), attempt number (int) and sessionId (string) and calls the relevant requestToken function and returns the promise returned by that function. If the resulting promise rejects, the rejection will propagate through to the attemptAuth promise.