
Exchange a SMART Authorization Code for a Patient-Context Session
Source:R/smart-fhir.R
smart_exchange_token.RdVerifies CSRF state equality and RFC 7636 code_verifier length before
exchanging the authorization code at config$token_endpoint.
Usage
smart_exchange_token(
config,
code,
redirect_uri,
client_id,
code_verifier,
expected_state = NULL,
received_state = NULL,
mock_response = NULL
)Arguments
- config
SMART configuration list from
smart_discover_config().- code
Authorization code received at
redirect_uri.- redirect_uri
Callback redirect URI.
- client_id
Registered OAuth2 client identifier.
- code_verifier
PKCE
code_verifiermatching thecode_challenge.- expected_state
Expected CSRF
stategenerated insmart_build_auth_url().- received_state
statequery parameter returned by the auth server.- mock_response
Optional named list for offline/unit testing.