attachIdentity

fun attachIdentity(    context: AuthenticationService.Context,     displayName: String? = null,     profile: Any? = null,     messageDetails: OneTimePasswordMethod.MessageDetails? = null,     callback: WebcomDoneCallback)

Either creates a new Webcom account and attach an identity to it (if context is Context.New) or attaches a new identity to the Webcom account of the currently authenticated user (if context is Context.Current), as new identity to the Webcom account of the currently authenticated user (if context is Context.Current), as the first step of an identity attachment call-flow.

In both cases, the attached identity is managed by the identity provider associated with this OneTimePasswordMethod instance and is bound to the identifier associated with this OneTimePasswordMethod instance (passed to the AuthenticationService.getOneTimePasswordMethod method).

A displayName and some profile data may be added to the created identity.

Once the new identity created, the Webcom back end sends a verification code to the user (to be verified when further calling the verifyAndAuthenticate method at the next step of the call-flow). The messageDetails of this message may be customized. If not specified, the "create" template is used.

This operation is asynchronous and calls the given callback once performed.