Page Contents

Home > @loopback/authentication > UserIdentityService > linkExternalProfile

UserIdentityService.linkExternalProfile() method

link an external profile with an existing local user id.

Signature:

linkExternalProfile(userId: string, userIdentity: I): Promise<U>;

Parameters

Parameter Type Description
userId string  
userIdentity I  

Returns:

Promise<U>

Example

async linkExternalProfile(userId: string, ldapUser: LDAPUserIdentity) { return await this.userIdentityRepository.findOrCreate({ provider: ‘ldap’, externalId: ldapUser.id, authScheme: ‘active-directory’, userId: userId, credentials: { distinguishedName: ldapUser.dn, roles: ldapUser.memberof, expirationTime: ldapUser.maxAge} }); } }