openapi-generators / openapi-generators/openapi-python-client

Oauth support seems broken

Open
#1,235 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2k
Forks
293
Avg merge
34m
Merged PRs (30d)
1

Description

Describe the bug
I am trying to generate a client for an API with an clientCredentials oauth flow, but the generated client doesn't seem to manage the authentication at all: Searching the client's folder for the keyword oauth yields no results.

I can make it work by generating a token myself and using it in AuthenticatedClient, but I would expect the generated client to be able to handle that.

Is openapi-python-client supposed to generate a client that handles a clientCredentials oauth flow ?

OpenAPI Spec File

openapi: 3.0.3
info:
  title: Test API
  version: v1
paths:
  /test:
    get:
      security:
        - oauth2: []
      responses:
        '200':
          description: ""

components:
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          refreshUrl: https://whatever.com/oauth/token/
          tokenUrl: https://whatever.com/oauth/token/
          scopes: {}

Desktop:

  • OS: Ubuntu 22.04.5
  • Python Version: 3.12.7
  • openapi-python-client version: 0.24.2

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 by generating a client from the supplied OpenAPI YAML and inspect whether the generated client contains OAuth handling; compare this with the manually supplied token path using AuthenticatedClient. Done means the clientCredentials flow is handled by the generated client, or the supported behavior is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python
Domain
api, authentication
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.