OpenAPITools / OpenAPITools/openapi-generator

[BUG] Python Authentication path expecting auth token in oauth2 models

Open
#2,411 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Python Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • [ ✅ ] Have you provided a full/minimal spec to reproduce the issue?
  • [ ✅ ] Have you validated the input using an OpenAPI validator (example)?
  • [ ✅ ] What's the version of OpenAPI Generator used? 3.3.4
  • [ ✅ ] Have you search for related issues/PRs?
  • [ ✅ ] What's the actual output vs expected output? Able to generate a token without needing a token
Description

Generated SDK seems to be requesting a token for a token generating call, only seems to be an issue with python

Example generated SDK

api_instance = API.AuthenticationApi(API.ApiClient(configuration))
openapi-generator version

3.3.4

OpenAPI declaration file content or url

Swagger 2.0 spec

securityDefinitions:
  OAuth2:
    type: oauth2
    flow: application
    tokenUrl: 'example.com'
    scopes:
      LOT_DEVICES_READ: LOT_DEVICES_READ
paths:
  /oauth/token:
      summary: Generate OAuth2 token
      tags:
        - Authentication
      operationId: auth token
      produces:
        - application/json
      consumes:
        - application/x-www-form-urlencoded
      parameters:
        - name: client_id
          in: formData
          required: true
          type: string
          description: ''
        - name: client_secret
          in: formData
          required: true
          type: string
          description: ''
        - name: grant_type
          in: formData
          required: true
          type: string
          default: client_credentials
Steps to reproduce

Generate SDK with the above

Related issues/PRs
Suggest a fix

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Python generator's OAuth2 handling and the generated AuthenticationApi from the supplied Swagger 2.0 specification. Reproduce the token request and compare it with the authentication behavior of protected operations. Done means the token endpoint no longer requires an existing token while normal authenticated calls still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python
Domain
api, authentication, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.