Skip to content

Fix loginToServer content type and missing grant_type#2821

Merged
danielaskdd merged 3 commits intomainfrom
fix-login-form-data-type-1529585928018714723
Mar 22, 2026
Merged

Fix loginToServer content type and missing grant_type#2821
danielaskdd merged 3 commits intomainfrom
fix-login-form-data-type-1529585928018714723

Conversation

@danielaskdd
Copy link
Copy Markdown
Collaborator

The login form was failing because it was sending credentials as multipart/form-data without the grant_type field, which is required by the FastAPI OAuth2PasswordRequestForm. This PR fixes the issue by:

  1. Using URLSearchParams to ensure the correct application/x-www-form-urlencoded content type is used.
  2. Adding grant_type: 'password' to the request body.
  3. Removing the explicit Content-Type header, allowing Axios/browser to set it automatically based on the URLSearchParams data.

Fixes #2820


PR created automatically by Jules for task 1529585928018714723 started by @danielaskdd

… multipart/form-data

The FastAPI OAuth2PasswordRequestForm requires the request to be sent as application/x-www-form-urlencoded and also needs the grant_type field.
This change replaces FormData with URLSearchParams in the loginToServer function and adds the missing grant_type: 'password' field.

Co-authored-by: danielaskdd <36760595+danielaskdd@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@danielaskdd
Copy link
Copy Markdown
Collaborator Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

…failure

- pass original refreshError as cause to Error constructor for better error tracing
- set 'Content-Type' to 'application/x-www-form-urlencoded' explicitly
- ensure form data is correctly interpreted by the server on login
@danielaskdd danielaskdd merged commit 3b928a5 into main Mar 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:loginToServer sends multipart/form-data instead of application/x-www-form-urlencoded

1 participant