Skip to content

Authentication is not complete? #11

@Rasool221

Description

@Rasool221

via this SDK, I am trying to authenticate to my self hosted Permify HTTP service. I have a pre-shared key setup. reading the docs, I am configuring my client as such:

self._api_client = ApiClient(
    configuration=Configuration(
        host=host,
        api_key={'ApiKeyAuth': pre_shared_key},
        api_key_prefix={'ApiKeyAuth': 'Bearer'},
    ),
)

but, I am getting this error when calling any endpoint via this client:

{"code":2, "message":"ERROR_CODE_MISSING_BEARER_TOKEN", "details":[]}

I believe I am doing everything correctly. ApiKeyAuth is the proper value mentioned in the README.md file in this repository and in the OAS specification.

via a local proxy, I was able to confirm that the Authorization header was not being sent. therefore, I dug into this repo's code.

i believe the relevant code for applying the auth config from the Configuration class is incomplete. for example, in every Api class (such as PermissionApi), this piece of code is present:

# authentication setting
_auth_settings: List[str] = [
]

this variable is left empty and not updated. following this line of code, the Api classes call self.api_client.param_serializer() which takes that variable as a parameter and checks if it has values. because this variable is always empty, the authentication settings for the api are not added in headers.

am i misunderstanding this code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions