Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.07k stars 1.19k forks source link

MSAL Authentication and InteractiveBrowserCredential #27800

Closed daggubatirao closed 10 months ago

daggubatirao commented 11 months ago

We have react SPA and asp.net webapi, both use Azure AD authentication. React app uses MSAL libraries and get the token, which can be used to call webapi. However if we use azure-sdk-for-js, how can we use the existing token and convert to InteractiveBrowserCredential? If we try to get a toekn using InteractiveBrowserCredential, it will ask to reauthenticate.

jeremymeng commented 11 months ago

@daggubatirao you could try implementing the TokenCredential interface, returning the existing token from getToken()

https://github.com/Azure/azure-sdk-for-js/blob/c73618e2946852ac36b5379d158044ee68f64afe/sdk/core/core-auth/src/tokenCredential.ts#L10

github-actions[bot] commented 11 months ago

Hi @daggubatirao. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] commented 11 months ago

Hi @daggubatirao, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!