Created
June 13, 2018 17:24
-
-
Save santiagovidal/70ea46fe6ea4416cc98974df618bc15b to your computer and use it in GitHub Desktop.
NemID authentication with Auth0 Lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const auth0ClientId = ..; | |
const nemIdConnection = ..; | |
const auth0Domain = ..; | |
const redirectUrl = ..; | |
var options = { | |
language: 'da', | |
allowedConnections: [nemIdConnection], | |
container: 'lock-wrapper', | |
auth: { | |
sso: false, | |
redirect: false, | |
popupOptions: { width: 327, height: 466, left: 200, top: 300 }, | |
responseType: 'token', | |
params: { | |
scope: 'openid profile' | |
} | |
} | |
}; | |
if ($('#lock-wrapper').length > 0){ | |
var lock = new Auth0Lock(auth0ClientId, auth0Domain, options); | |
lock.show(); | |
lock.on("authenticated", function(authResult) { | |
lock.getUserInfo(authResult.accessToken, function(error, profile) { | |
// Do some stuff with the profile | |
lock.logout({ | |
returnTo: redirectUrl, | |
clientID: auth0ClientId, | |
federated: true | |
}); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment