Private
attemptPrivate
Optional
Readonly
busyCalled 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.
Private
chosenPrivate
Readonly
clientPrivate
currentPrivate
dataPrivate
emailPrivate
Optional
emailPrivate
Readonly
inputsPrivate
Readonly
matrixPrivate
Readonly
requestCalled 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.
Private
Readonly
requestA 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.
Private
requestingPrivate
Readonly
stateCalled 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
The login type specific objects are as follows: m.login.email.identity: * emailSid: string, the sid of the active email auth session
Private
submitPrivate
chooseInternal
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
NoAuthFlowFoundError If no suitable authentication flow can be found
Private
chooseInternal
Pick the next auth stage
login type
NoAuthFlowFoundError If no suitable authentication flow can be found
Private
doInternal
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
startInternal
Pick the next stage and call the callback
NoAuthFlowFoundError If no suitable authentication flow can be found
submit 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.
Param
options object