Hi @Chekuri, Suneetha ,
Thanks for reaching out.
I understand that you are trying to get access token using Authorization code flow from an angular web Application which is now supported by MSAL Angular v2 library.
The @azure/msal-angular enable authentication in Angular Web Applications without backend servers. This version of the library uses the OAuth 2.0 Authorization Code Flow with PKCE.
First you need to register the angular application MSAL.js 2.0 with auth code flow.
Select the application registered in Azure portal.
Under manage->Select Authentication-> Add platform.
Under Web Application, select the Single-page application.
Do NOT select either checkbox under Implicit grant and hybrid flows.
By configuring your redirect URI using the Single-page application tile in the Add a platform pane, your application registration is configured to support the authorization code flow with PKCE and CORS.
Configure the required application registered values to the angular application config.
Also you need to register the node server API in Azure Portal.
In the app's registration screen, select the Expose an API blade to the left to open the page where you can declare the parameters to expose this app as an Api for which client applications can obtain access token for and add those permissions in web application.
Install angular package on NPM.
npm install @azure/msal-browser @azure/msal-angular@latest
Below is the sample you can refer to get the token using authorization code flow to call the Microsoft Graph API. In the same way you can call custom protected API registered in Azure AD.
https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-angular-auth-code
Hope this will help.
Thanks,
Shweta
--------------------------------------------------------------------------
Please remember to "Accept Answer" if answer helped you.