benbaran / adal-angular4

Angular 4/5/6/7 ADAL Wrapper
MIT License
86 stars 104 forks source link

acquireToken is getting null after logged in for 1st time and it gets for subsequent requests #95

Closed BKB503 closed 5 years ago

BKB503 commented 6 years ago

I'm using acquire token functionality to get access token and get data from web api end point, but sending the request for 1st time acquire token is getting null and after second request it is getting the acquire token and works fine.

is there any work around for this or is this the bug ?

rahulraibit commented 6 years ago

This library is still using 1.0.15 version of adal angular. That's why for now there is no options to increase the timeout by setting loadFrameTimeout in configuration. Default LOADFRAME_TIMEOUT: '6000'. This issue can be resolve if this library will upgrade to 1.0.17 version of adal angular.

BKB503 commented 6 years ago

Thanks for your reply Rahul. But it is not taking that long to make second request it was less than 6000 seconds and any idea when will be next release carried out? any work around mean while?

rahulraibit commented 6 years ago

Hi, Let me first clarify that Default LOADFRAME_TIMEOUT: '6000' is in ms not in second. https://github.com/AzureAD/azure-activedirectory-library-for-js/wiki/Config-authentication-context

For solving this issue I would suggest Please use another library.

https://www.npmjs.com/package/adal-angular5

BKB503 commented 6 years ago

Thanks Rahul I mean to say it 6 seconds or 6000 ms. I can understand that

I have tried other package even that is using adal library 1.0.15

can we use MSAL library ?

geerzo commented 5 years ago

v4.x of this library now support adal.js 1.0.17+

dubcdr commented 5 years ago

@geerzo

So do i set loadFrameTimeout in my config object like so:

const config = {
  instance: 'https://login.microsoftonline.com/',
  tenant: 'foobar.onmicrosoft.com',
  clientId: qa_group_id,
  loadFrameTimeout: 10000,
  endpoints
};
adalService.init(config);
geerzo commented 5 years ago

Hmmm, good question. I updated the library to 1.0.17 but we didn't add the additional config options. Can you do a pull request? Otherwise I'll try to get to it as I can.

dubcdr commented 5 years ago

Yeah i'll try and get that up this week. will be my first open source contribution 💪