diff --git a/fhirclient/auth.py b/fhirclient/auth.py index af77c27c3..0127ff980 100644 --- a/fhirclient/auth.py +++ b/fhirclient/auth.py @@ -44,7 +44,6 @@ def from_capability_security(cls, security, state=None): state['token_uri'] = ee.valueUri elif 'authorize' == ee.url: state['authorize_uri'] = ee.valueUri - auth_type = 'oauth2' elif 'register' == ee.url: state['registration_uri'] = ee.valueUri break @@ -56,9 +55,11 @@ def from_capability_security(cls, security, state=None): state['registration_uri'] = e.valueUri elif "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#authorize" == e.url: state['authorize_uri'] = e.valueUri - auth_type = 'oauth2' elif "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris#token" == e.url: state['token_uri'] = e.valueUri + + if 'authorize_uri' in state or ('token_uri' in state and 'jwt_token' in state): + auth_type = 'oauth2' return cls.create(auth_type, state=state)