Skip to main content

authentication

Authentication classes for NextGen interactions.

Classes​

NextGenAuthSession​

class NextGenAuthSession(smart_on_fhir: SMARTOnFHIR):

Session that uses bearer authentication and auto-retry for NextGen APIs.

Differs from BearerAuthSession in that it contains functionality to auto-retrieve a new NextGen token from SMARTOnFHIR if the other is found to be expired.

Variables​

  • token : str - Returns the current NextGen token or gets one if necessary.

Methods​


refresh_token​

def refresh_token(self) ‑> str:

Discard the cached token, fetch a new one, and return it.

Writes the new token back to the cache, so every later request and token read carries it rather than the one it replaced.

Returns The new token.

request​

def request(    self,    method: str | bytes,    url: str | bytes,    params: MutableMapping[str, Any] | None = None,    data: Any = None,    headers: MutableMapping[str, str] | None = None,    **kwargs: Any,) ‑> requests.models.Response:

Performs an HTTP request.

Overrides requests.session.request, appending our access token to the request headers or API keys if present.