connecting front end react spa with node.js backend daemon service

md-1799 1 Reputation point
2021-09-29T12:00:03.137+00:00

Hi, I have a react SPA using @azure/msal-react and @azure/msal-browser - similar to this tutorial, so I can sign in, call the MS graph api, sign out etc as documented there. Sp far, so good.

However, for my app I want the user signing in to the react SPA to be authorising a backend service / daemon (for my app) to perform actions on their behalf against the graph api, even when they don't have the react SPA open and signed in. The backend is written in node.js sitting behind an api gateway. So I'm thinking there might be some way to pass the client side information / tokens across to @azure/msal-node so that the backend daemon can keep using the graph api on behalf of the user - but I can't find any information around this.

Is this possible? Can anyone point me at some material in the right direction?

Thanks! Mark

Update: it seems to me what I'm trying to do is similar in intent to this section of this page: https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-acquire-cache-tokens#advanced-accessing-the-users-cached-tokens-in-background-apps-and-services - sharing the token cache?

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,439 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. md-1799 1 Reputation point
    2021-09-30T10:40:42.153+00:00

    Update: I think i've realised i have this very backwards, i'll post back if i get it going the right way around

    0 comments No comments