Wednesday, 17 October 2018

detect if silentlogin is possible in adaljs-angular4

I'm using the library adal-angular4@3.0.13 in a angular 6 project. I try to do following:

  1. If a silentlogin (login without prompting the user for credentials) with office365 is possible, then do a silentlogin (with _adalService.login()

  2. If a silentlogin is not possible, then show a "login" button within a welcome-screen.

A silentlogin would be possible, when I'm authenticated to azure-ad / o365 and the cookie is still valid.

To find out, if a silentlogin is possible, i tried following:

try {
  let token = await this._adal.acquireToken(this._config.clientId).toPromise();
  return true;
} catch (e) {
  console.log('acquireToken error', e);
  return false;
}

But it always returns:

User login is required

But when calling _adalService.login() it does a silentlogin.

My question: How can i find out, if adaljs can login without prompting for credentials (it should be possible, like reading it from a o365-cookie)?



from detect if silentlogin is possible in adaljs-angular4

No comments:

Post a Comment