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

Oauth support seems broken

未关闭
#1,235 0 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
2k
派生
293
平均合并
34 分钟
30 天内合并 PR
1

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先根据提供的 OpenAPI YAML 生成客户端,并检查生成的客户端是否包含 OAuth 处理;将其与使用 AuthenticatedClient 手动提供的令牌路径进行比较。当生成的客户端能够处理 clientCredentials 流,或已明确确定受支持的行为时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
openapi, python
领域
api, authentication
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。