AzureAD / azure-activedirectory-library-for-js

The code for ADAL.js and ADAL Angular has been moved to the MSAL.js repo. Please open any issues or PRs at the link below.
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/maintenance/adal-angular
Apache License 2.0
627 stars 372 forks source link

adal.js client side/off perm calling SP rest api, what am I missing? #872

Closed jkyoungchoi closed 4 years ago

jkyoungchoi commented 5 years ago

I'm trying to retrive SP site,list,items from off-perm with JS.

Got id_token with adal.js and its sample code. So with the id_token that I received made various calls to endpoints (including SP Site's api endpoint), something like below


$.ajax({
type: "GET",
url: "https://graph.microsoft.com/v1.0/me/",
headers: {
 'Authorization': 'Bearer ' + token,
},
});

whatever I try keep getting 401.

Azure app has permission for Graph api and SP.

I feel like I'm missing something but reading manuals keeps getting me somewhere else.

Can anyone guide me what I did wrong?

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Browser:

Library Name

Library version

Library version: current

Current behavior

Expected behavior

Minimal reproduction of the problem with instructions

jmckennon commented 4 years ago

It's a bit hard to debug your code and usage without more information. If you're still unable to fix the 401s, do you think you could provide the exact error and the exact code usage, including what's happening before that ajax request?

Additionally, all current authentication work from Microsoft is delivered through the msal js library here. adal js is still supported only for security fixes. We recommend moving to msal js for any advanced feature requests and bugfixes.

jkyoungchoi commented 4 years ago

It's a bit hard to debug your code and usage without more information. If you're still unable to fix the 401s, do you think you could provide the exact error and the exact code usage, including what's happening before that ajax request?

Additionally, all current authentication work from Microsoft is delivered through the msal js library here. adal js is still supported only for security fixes. We recommend moving to msal js for any advanced feature requests and bugfixes.

Thanks for reply, it worked out afterwords.