FusionAuth v1.13.2登录接口报[couldNotConvert]userId错误求助
Let's break down what's happening here first—your error message spells out the core issue clearly:
"fieldErrors": { "userId": [ { "code": "[couldNotConvert]userId", "message": "Invalid userId on the URL [index]. This must be a valid UUID String (e.g. 25a872da-bb44-4af8-a43d-e7bcb5351ebc)." } ] }
The problem is that your request URL includes a segment (index) that FusionAuth is trying to interpret as a userId parameter, but you're actually attempting to log in using a loginId (email address). This mismatch between the endpoint you're hitting and the login method you're using is causing the validation failure.
Why This Happens
FusionAuth has two distinct login endpoints tailored to different authentication methods:
- To log in with a
userId, you use a URL with a UUID path parameter:POST /api/login/{userId}(replace{userId}with the user's valid UUID) - To log in with a
loginId(like your test emailtest@test.nl), you need to send a POST request directly to/api/login—no extra path segments or trailing slashes allowed.
It seems your request is hitting a URL like http://localhost:9011/api/login/index (or even just /api/login/ with a trailing slash might trigger the server to parse an empty/invalid segment as userId). FusionAuth sees that final index part of the URL and tries to treat it as a userId, which obviously isn't a valid UUID format.
Step-by-Step Fix
- Update your request URL: Send your POST request to
http://localhost:9011/api/login(no trailing slash, no extra path bits likeindex). - Verify your request configuration:
- Confirm you're using the
POSTHTTP method - Set the
Content-Typeheader toapplication/json - Keep your request body exactly as you have it—since you're using
loginId, you don't need to include auserIdanywhere:{ "loginId":"test@test.nl", "applicationId":"e2e45cc3-6710-4af9-b3c2-2d6f6cbbceed", "password":"***********", "ipAddress": "192.168.1.42" }
- Confirm you're using the
- Quick sanity check: In the FusionAuth console, make sure your test user is actually linked to the application with ID
e2e45cc3-6710-4af9-b3c2-2d6f6cbbceed—if the user isn't associated with the app, you might run into a different error after fixing the URL.
Note for FusionAuth v1.13.2
This endpoint behavior hasn't changed significantly in newer FusionAuth versions, so this fix applies directly to your v1.13.2 deployment. Just ensure your request aligns with the correct endpoint for your chosen login method.
内容的提问来源于stack exchange,提问作者Tjep Meindersma

