I am getting CORS error when I am trying to call the below API of Azure Active Directory
https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize?client_id={cliendId}&scope=https://outlook.office.com/IMAP.AccessAsUser.All offline_access&redirect_uri=http://localhost&response_type=code
from my Angular application.
This same API works when I paste it in Chrome and hit the enter button, and in response I get the authorization code, but the same doesn't work for Angular. I researched the issue on Google and understood that the issue is because both the domains (client and auth server) are different. Is there a way I can solve this CORS error?
Additional info:
In Azure Active Directory, I have set Web as the redirect URI, as I was previously getting an error with SPA (please correct me if I have used the wrong redirect URI).
I have also attached a sequence diagram explaining what I need to do with the auth code.
Thanks in advance!
Edited:
I have added the whole flow of communication channel with figma designs