Closed filipkowal closed 3 years ago
@filipkowal I'm trying to do the same thing. Are you saying that you did something like this with this library?
<MicrosoftLogin responseType="code"
</MicrosoftLogin>
Thought it doesn't seem like this library supports the auth code flow, see this closed issue: https://github.com/alexandrtovmach/react-microsoft-login/issues/62
@axme100 This library doesn't support it.
The official MS library msal-browser
does support the authorization code flow
but in a different way. The frontend never gets the authorization code
directly.
After reading these docs on the authorization code flow I've tried to simply create a GET request
(without any MS login related library) from the client that would include response_type=code
but even though I've correctly configured the app in Azure AD I keep on getting CORS
errors. It seems that getting the autorization code
directly to frontend is not possible.
This discussion with a msal-browser
maintainer tackles exactly the flow we would like to achieve but the solution seems very complicated.
If it helps someone: I ended up creating the authorize URL manually and open a popup to start the flow using response_type=code
and response_mode=query
and I was finally able to get the flow as react-google-login does out of the box.
I need to authenticate the user with authentication code flow so the back-end accepts the
authorization code
instead ofauthentication token
. Can it be achieved with this library? I've found out that providingresponseType="code"
to the MS API would change the response to theauthorization code
.