benbaran / adal-angular4-example

Angular 4 ADAL Wrapper Example
28 stars 13 forks source link

Token is not valid #10

Closed kivancbakdi closed 6 years ago

kivancbakdi commented 6 years ago

I did not have a problem getting access token and user information, thank you for that.

However, this access token can not be used on the CRM ODATA API.

My configuration;

return { instance: 'https://login.microsoftonline.com/', tenant: 'my_tenant', clientId: 'my_clientId', endpoints: { 'resource_id': 'resource_url' }, postLogoutRedirectUri: "http://localhost:4200/", extraQueryParameter: 'nux=1', popUp: false, cacheLocation: 'localStorage' }

HTTPGET : https://xxx.crm4.dynamics.com/api/data/v8.2/new_licencemonitors?$filter=new_licencemonitor_countofseat%20ne%200&$select=new_licencemonitor_countofseat,_new_licencemonitor_account_value

Headers:

Authorization: Bearer xxx
Content-Type: application/json

Error: HTTP Error 401 - Unauthorized: Access is denied

Do you have any idea why?

Solved. I just remove the library.

RasikaMK commented 6 years ago

Hi, I am facing exact same issue. Could you please explain how you solved this?

kivancbakdi commented 6 years ago

Hi @RasikaMK ,

Of course;

Let's start by install this package: https://www.npmjs.com/package/ng2-adal

And you can check this link on how to use it: https://github.com/ranveeraggarwal/angular-adal-quickstart

Please do not hesitate to contact me if you have any problems: kivanc.bakdi@peakup.org