A cloud-based identity and access management service for securing user authentication and resource access
Hello @Kasun Tharaka , I understand you want to obtain the authorization code using MSAL.js and pass it to the backend so that it can exchange it for an access and refresh token. Although technically possible: you can leverage APIs such as StandardInteractionClient.initializeAuthorizationCodeRequest(AuthorizationUrlRequest) and others, this flow is not standard thus not supported. You would be creating a public client to get an authorization code to and a private client that exchanges the former. The authorization code would be sent through the wire w/o additional protection such as the one provided by PKCE which is already supported out of the box by MSAL.js.
My recommendation is to get an access token using MSAL.js and implement the OBO flow in your backend so that it can request an access and refresh token for a down-stream API or service using the frontend access token.
Let us know if you need additional assistance. If the answer was helpful, please accept it and complete the quality survey so that others can find a solution.