Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OIDC token never requested #211

Open
christian-schmaler-snkeos opened this issue Sep 8, 2023 · 2 comments
Open

OIDC token never requested #211

christian-schmaler-snkeos opened this issue Sep 8, 2023 · 2 comments

Comments

@christian-schmaler-snkeos

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

@migraf
Copy link
Owner

migraf commented Sep 12, 2023

You are right.. Oauth2 auth flow seems to just not be used 😅. It was there some time ago but must have fallen out during some merge very early. I'll look into it. A fix shouldn't take too long.

@migraf
Copy link
Owner

migraf commented Sep 13, 2023

I've just published version 1.0.3. which has basic OIDC support. Let me know if this works for you. I hope I can add more sophisticated OIDC support soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants