View Source Oidcc.Userinfo (Oidcc v3.2.6)
OpenID Connect Userinfo
See https://openid.net/specs/openid-connect-core-1_0.html#UserInfo
Telemetry
[:oidcc, :userinfo, :start]
- Description: Emitted at the start of loading userinfo
- Measurements:
%{system_time: non_neg_integer(), monotonic_time: integer()}
- Metadata:
%{issuer: :uri_string.uri_string(), client_id: String.t()}
[:oidcc, :userinfo, :stop]
- Description: Emitted at the end of loading userinfo
- Measurements:
%{duration: integer(), monotonic_time: integer()}
- Metadata:
%{issuer: :uri_string.uri_string(), client_id: String.t()}
[:oidcc, :userinfo, :exception]
- Description: Emitted at the end of loading userinfo
- Measurements:
%{duration: integer(), monotonic_time: integer()}
- Metadata:
%{issuer: :uri_string.uri_string(), client_id: String.t()}
Summary
Functions
Load userinfo for the given token
Functions
@spec retrieve( access_token :: String.t(), client_context :: Oidcc.ClientContext.t(), opts :: :oidcc_userinfo.retrieve_opts() ) :: {:ok, :oidcc_jwt_util.claims()} | {:error, :oidcc_userinfo.error()}
@spec retrieve( token :: Oidcc.Token.t(), client_context :: Oidcc.ClientContext.t(), opts :: :oidcc_userinfo.retrieve_opts() ) :: {:ok, :oidcc_jwt_util.claims()} | {:error, :oidcc_userinfo.error()}
Load userinfo for the given token
For a high level interface using Oidcc.ProviderConfiguration.Worker
see Oidcc.retrieve_userinfo/5
.
Examples
iex> {:ok, pid} =
...> Oidcc.ProviderConfiguration.Worker.start_link(%{
...> issuer: "https://api.login.yahoo.com"
...> })
...>
...> {:ok, client_context} =
...> Oidcc.ClientContext.from_configuration_worker(
...> pid,
...> "client_id",
...> "client_secret"
...> )
...>
...> # Get access_token from Oidcc.Token.retrieve/3
...> access_token = "access_token"
...>
...> Oidcc.Userinfo.retrieve(
...> access_token,
...> client_context,
...> %{expected_subject: "sub"}
...> )
...> # => {:ok, %{"sub" => "sub"}}