Skip to content

Instantly share code, notes, and snippets.

@santiagovidal
Created June 13, 2018 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santiagovidal/70ea46fe6ea4416cc98974df618bc15b to your computer and use it in GitHub Desktop.
Save santiagovidal/70ea46fe6ea4416cc98974df618bc15b to your computer and use it in GitHub Desktop.
NemID authentication with Auth0 Lock
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