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 374 forks source link

Set JWT-Token manually #782

Closed HofmT closed 5 years ago

HofmT commented 6 years ago

Dear all,

for our SPA we are using ADAL for authentication. Now we have a scenario where we get a valid JWT from another service (meaning outside of the ADAL login procedure). I would like to set this token manually into the ADAL library so that we can take advantage of the other methods provided by ADAL, such as getCachedToken()

So I tried the following. I set the token inside the URL like this: http://127.0.0.1:8081/#id_token=eyJhbGciOiJSUzI1NiIsInR(..)ZF3QtQNA

and inside JavaScript I then execute the handleWindowCallback by ADAL assuming that ADAL would retrieve the token from the URL and store it locally inside the locatStorage. Unfortunately that did not work. So my question is: Is the approach in general correct or do I have to take another one?

Thanks for any help! Kind regards Tobias

nehaagrawal commented 5 years ago

@HofmT This is not the correct approach. You can't set the idToken that you got from outside in adal. If you already have an id_token, what is you are trying to achieve from adal? You may use the login_hint/sid from the id_token to get the access token. Can you please elaborate your use case?

HofmT commented 5 years ago

@nehaagrawal Ok, I think I had a wrong understanding of ADAL and therefore tried to misuse it. I will therefore close it.