Optional
login: stringThe user's username (when using JCoreOptions.legacyAuthentication)
Optional
password: stringThe user's password (when using JCoreOptions.legacyAuthentication
Error if bad credentials or server error.
const userLogin = "jdo@mycompany.com"
const userPassword = "xxx"
// Open a new user session, and get back user data from server
JMap.User
.login(userLogin, userPassword)
.then(sessionData => {
console.log(`User ${userLogin} has been authenticated, his session token is "${sessionData.accessToken}"`)
})
.catch(errorKey => {
console.error(`Cannot loggin ${userLogin}, errorKey="${errorKey}"`, error)
})
JMap.User.login
The login function, returns a promise.
When using the new oAuth2 authentication scheme, no username or password are required. It triggers a redirect to the identity provider, resolving with not data.
When using the legacy REST API-based authentication scheme, username and password are mandatory. The method will make a call to the server and if login is successful resolve the promise providing the user session data.
If an error occurs, 3 differents string message can be returned :