Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Configuration.api_key* are not really used

未关闭
#10 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

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

调研方向

从 Configuration(api_key=...) 和使用 access_token 的 README.md 示例开始,然后跟踪 ApiClient 如何对 AdminApi->admin_apps_list 进行身份验证。重现 403,并验证所选配置会生成经过身份验证的请求;当文档中的 token 术语与可正常工作的配置行为一致时,即表示完成。

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

描述

I got tempted to pass api_key = 'my-super-duper-secret-key' to the Configuration object, as one has an API key at hand, and all I got was a 403 Error (t-shirt material right there).

import os
import sys
import authentik_client


def main():
    host = os.environ.get("AUTHENTIK_HOST") # I passed here a URL ending in "/api/v3" even though is called "host", see #9 
    token = os.environ.get("AUTHENTIK_TOKEN")
    if not token:
        print("AUTHENTIK_TOKEN unset")
        sys.exit(1)

    if not host:
        print("AUTHENTIK_URL unset")
        sys.exit(1)

    configuration = authentik_client.Configuration(
        host=host,
        api_key=token
    )

    with authentik_client.ApiClient(configuration) as api_client:
        # Create an instance of the API class
        api_instance = authentik_client.AdminApi(api_client)
        try:
            api_response = api_instance.admin_apps_list()
            print("The response of AdminApi->admin_apps_list:\n")
            print(api_response)
        except authentik_client.ApiException as e:
            print("Exception when calling AdminApi->admin_apps_list: %s\n" % e)


if __name__ == "__main__":
    main()

When invoking it I got:

python move-okta-app-to-authentik.py 
Exception when calling AdminApi->admin_apps_list: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'date': 'Thu, 30 Oct 2025 20:47:20 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '58', 'allow': 'GET, HEAD, OPTIONS', 'referrer-policy': 'same-origin', 'vary': 'Accept-Encoding, Cookie', 'x-authentik-id': 'af8d40bf08934e5cb8e602be325694f6', 'x-content-type-options': 'nosniff', 'x-frame-options': 'DENY', 'x-powered-by': 'authentik', 'strict-transport-security': 'max-age=31536000; includeSubDomains'})
HTTP response body: detail='Authentication credentials were not provided.' code=None

In fairness the example in the REAMDE.md points out the usage of access_token, however it doesn't really align with the nomenclature.

# Configure Bearer authorization: authentik
configuration = authentik_client.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

But your API Credential to interact with the server is a "Bootstrap token", and for users you can create "Token"'s, (notice the lack of "Access").

主要语言
Mustache
星标
2
派生
1
平均合并
15 小时 5 分钟
30 天内合并 PR
2

贡献指南

这个仓库没有索引到贡献指南

从这里开始

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

goauthentik/client-python 的其他 Issue

查看 goauthentik/client-python 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

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