Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Configuration.api_key* are not really used

Đang mở
#10 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu với Configuration(api_key=...) và ví dụ trong README.md sử dụng access_token, sau đó lần theo cách ApiClient xác thực AdminApi->admin_apps_list. Tái hiện 403 và xác minh rằng cấu hình đã chọn tạo ra các request được xác thực; hoàn tất khi thuật ngữ token được ghi trong tài liệu và hành vi của cấu hình đang hoạt động là nhất quán.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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").

Ngôn ngữ chính
Mustache
Star
2
Fork
1
Merge trung bình
15 giờ 5 phút
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của goauthentik/client-python

Tất cả issue của goauthentik/client-python

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.