Skip to content

OIDC token never requested #211

@christian-schmaler-snkeos

Description

Describe the bug
The FhirServer is configured to work with client credentials, but seems to never request a token.
FhirServer._get_oidc_token() is the code where a token would be requested but seems to be never called anywhere.
The examples and documentation suggest that
fhir_server = FhirServer("https://fhir.server/fhir", client_id="client_id", client_secret="secret", oidc_provider_url="url")
should be enough to get the authorization working.
How is this supposed to work?

To Reproduce

fhir_server = "https://localhost:443/fhir"
oidc_provider_url = "https://localhost:443/iam/oauth2/token"
client_id = None
client_secret = None

with open("appsettings.json") as sfp:
    settings = json.load(sfp)
    client_id = settings["ClientID"]
    client_secret = settings["ClientSecret"]

# Connect using oauth2/oidc
oidc_server = FhirServer(fhir_server, client_id=client_id, client_secret=client_secret,
                         oidc_provider_url=oidc_provider_url)

# Query resources based on name of resource
query = oidc_server.query("Patient", output_format="json").all()

Expected behavior
Tokens are requested using client id and client secret.

Additional context
fhir-kindling 1.0.2 with Python 3.11.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions