Retains configured, non-secret fields from an OAuth token response.
A provider opts in with the Nango catalog key "token_response_metadata" in
its metadata: a list of response field names such as ["instance_url"].
A dotted name ("team.id") reads a nested object and is retained under the
dotted name itself.
Fields are read from OAuth2.AccessToken.other_params. OAuth2 has already
moved access_token, refresh_token, expires_in, and token_type out of
that map, so those can never be retained. Only string, number, and boolean
values are kept; absent, nil, and non-scalar values are skipped, as is any
name matching Tango.Validation.sensitive_key?/1 (for example id_token).
The result may be empty.
Summary
Functions
Extracts the configured fields from a token response's extra params.
Checks a "token_response_metadata" setting: nil or a list of non-blank
field names.
Functions
Extracts the configured fields from a token response's extra params.
Returns {:error, :invalid_grant_metadata} when the retained fields encode
to more than 4 KiB of JSON.
Checks a "token_response_metadata" setting: nil or a list of non-blank
field names.