pkce / azureAd - SPA / AADSTS700025 #321
-
Hi I'm trying to auth with azureAd with an existing app registration setup for SPA. I followed this, https://httpyac.github.io/guide/variables.html#oauth2-openid-connect When I provide the clientSecret I get: "AADSTS700025: Client is public so neither 'client_assertion' nor 'client_secret' should be presented." When I don't provide the clientSecret I get: "AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app" Any tips? Feels like I shouldn't need to provide the clientsecret. Httpyac should just get the auth code , send auth code & clientId to get the token. Auth code flow shouldn't require the client to send a client secret. See: https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow#redirect-uris-for-single-page-apps-spas |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
I think you are using wrong flow. AuthorizationCode Flow does not send Client Secret (Code) Please Set Loglevel to Debug and verify which Flow is used. Or maybe it is already written to OutputChannel httpyac - Request |
Beta Was this translation helpful? Give feedback.
-
I went through the code again. yes, you are right client_secret is also sent.
httpyac requires a redirect Uri to localhost:3000. This is a design decision of mine. Postman or Intellij Http Client force the use of the own browser with which you intercept the redirect and thus determine the access token (Man-In-The-Middle). I didn't want to go this way, as it would also allow me to intercept the password. httpyac therefore really needs localhost:3000 as the redirect Uri. I open an Http server on this port and wait for the AccessToken. |
Beta Was this translation helpful? Give feedback.
-
Now I notice something again. SPA should not use Authorization Code Flows because the client secret can not saved securly (https://learn.microsoft.com/de-de/entra/identity-platform/v2-oauth2-auth-code-flow) Therefore, the implicit flow would be more correct in this case. So either the way via WebApp + AuthorizationCode + Client Secret or SPA + Implicit Flow. In both cases, however, localhost:3000 is required as Redirect Uri |
Beta Was this translation helpful? Give feedback.
Now I notice something again. SPA should not use Authorization Code Flows because the client secret can not saved securly (https://learn.microsoft.com/de-de/entra/identity-platform/v2-oauth2-auth-code-flow)
Therefore, the implicit flow would be more correct in this case. So either the way via WebApp + AuthorizationCode + Client Secret or SPA + Implicit Flow. In both cases, however, localhost:3000 is required as Redirect Uri