Gamora.API (gamora v0.15.0)
View SourceThis module wraps the functions to access IDP's endpoints.
Summary
Functions
Gets token's data based on an access token using introspection endpoint in the IDP.
Gets user's data based on an access token using userinfo endpoint in the IDP.
Functions
@spec introspect(access_token :: String.t()) :: {:ok, OAuth2.Response.t()} | {:error, term()}
Gets token's data based on an access token using introspection endpoint in the IDP.
Parameters
- access_token: String [Access token generated by the IDP].
Examples
iex> introspect("bGWcAKadGrBwM...")
{:ok, %{active: true, ...}
iex> introspect("InvalidAccessToken")
{:error, :access_token_invalid}
@spec userinfo(access_token :: String.t()) :: {:ok, OAuth2.Response.t()} | {:error, term()}
Gets user's data based on an access token using userinfo endpoint in the IDP.
Parameters
- access_token: String [Access token generated by the IDP].
Examples
iex> userinfo("bGWcAKadGrBwM...")
{:ok, %{email: "test@example", phone_number: "+523344556677"}}
iex> userinfo("InvalidAccessToken")
{:error, :access_token_invalid}