Skip to content

[BUG] [Feign] Incorrect generated format with Content-Type: application/x-www-form-urlencoded #21266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
amarrategui opened this issue May 12, 2025 · 0 comments

Comments

@amarrategui
Copy link

Description

Hi, we are trying to genenerate an feign client to call an Oauth2 token method. In curl, this call is like this:

curl --request POST \
  --url https://xxxxxxxxxxxxxx/oauth2/v1/token \
  --header 'Authorization: Basic XXXXXXXX' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --header 'User-Agent: insomnia/9.3.2' \
  --data username=XXXXX \
  --data password=XXXXX \
  --data grant_type=password \
  --data scope=XXXXXXXXXXX/super_scope+offline_access 

but when we run the openapi generator, feign is doing this call:

https://xxxxxxxxx/oauth2/v1/token?username=XXXXXX&password=XXXXX&grant_type=password&scope=XXXXX/super_scope+offline_access'

that retuns a bad request exception

openapi-generator version

3.0.1

OpenAPI declaration file content or url
/token:
post:
tags:
- "Oauth2"
summary: "Generate new access and refresh token"
description: ""
operationId: "token"
parameters:
- in: "header"
name: "Authorization"
description: "Basic authentication"
required: true
schema:
type: string
requestBody:
description: Session credentials
content:
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/TokenRequest"
responses:
"200":
description: "Successful operation"
content:
application/json:
schema:
title: "TokenResponse"
oneOf:
- $ref: "#/components/schemas/OauthSuccess"
- $ref: "#/components/schemas/OauthError"
"400":
description: "Bad request"
content:
application/json:
schema:
$ref: "#/components/schemas/OauthError"
"401":
description: "Forbidden"
content:
application/json:
schema:
$ref: "#/components/schemas/OauthError"

Can help me to try to generate the request so that the parameters appear in the body and not in the URL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant