Boko Moko
Boko Moko

Reputation: 51

Sharepoint framework with React webpart - How to provide a token to already logged in user?

Suppose a Sharepoint framework webpart written in React. This app needs to access some backend API hosted in the same tenant. The user makes the login as always and is given access to the frontend React app. This React app needs to make some requests making use of a token. How to obtain the token from the AD without having to login again? Is there a way for the authenticated user make use of the API backend thru a token? How to obtain/renew the token? Do I have to implement this feature myself or is there a simpler way?

I tried to use the this.context.aadTokeProviderFactory.getTokenProvider() and the getToken() method. But it times out and doesn't return a token. My guess is that it's trying to open a login screen to re-authenticate the user (which I do not want).

Also, I can't use the {tenant} and/or {clientId}

Upvotes: 1

Views: 113

Answers (0)

Related Questions