fhir_authenticate: Create token for Authentication

View source: R/download_resources.R

fhir_authenticateR Documentation

Create token for Authentication

Description

This function is a wrapper to create an httr::Token object for authentication with OAuth2/OpenID Connect. Internally, it calls httr::oauth_app(), httr::oauth_endpoint() and httr::oauth2.0_token() to create a token that can then be used in fhir_search.

Usage

fhir_authenticate(
  secret,
  key,
  base_url,
  access,
  authorize,
  query_authorize_extra = list()
)

Arguments

secret

The consumer/client secret, belonging to key.

key

Consumer key, also called client ID. For Keycloak this would for instance be the Keycloak client, e.g. "postman".

base_url

The URL the user will be redirected to after authorization is complete. This will usually be the base url of you FHIR server.

access

The url used to exchange unauthenticated for authenticated token. This can be identical to authorize.

authorize

The url to send the client for authorization.

query_authorize_extra

A named list holding query parameters to append to initial auth page query. Could hold info about user identity and scope for keycloak like this:

list(scope = "openid",
     grant_type = "password",
     username = "fhir-user",
     password = "fhirtest")

fhircrackr documentation built on Feb. 16, 2023, 8:33 p.m.