Skip to content

Conversation

gregorvolkmann
Copy link

This pull request fixes an HTTP 400 error in production by updating the login function in frontend/src/hooks/useAuth.ts. The LoginService.loginAccessToken call was incorrectly passing { formData: data } instead of { formData: { data.username, data.password } }, causing a type mismatch and sending multipart/form-data instead of application/x-www-form-urlencoded. The change ensures compliance with the LoginLoginAccessTokenData type and corrects the login request format.

@alejsdev alejsdev added the bug Something isn't working label Jul 5, 2025
@alejsdev alejsdev changed the title Fix loginAccessToken Prop in useAuth.ts to Resolve 400 Error on dashboard login 🐛 Fix loginAccessToken Prop in useAuth.ts to Resolve 400 Error on dashboard login Jul 5, 2025
Copy link

@YuriiMotov YuriiMotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that there is no type mismatch here.

  • data parameter has type Body_login_login_access_token (see import: type Body_login_login_access_token as AccessToken)
  • loginAccessToken accepts parameter of type LoginLoginAccessTokenData (see implementation)
  • LoginLoginAccessTokenData is defined as {formData: Body_login_login_access_token} (see declaration)

And, application/x-www-form-urlencoded is hardcoded here. So, it shouldn't depend on data passed to this function.

So, everything seems to be correct in current implementation and no changes needed.

@gregorvolkmann, could you please double-check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants