Lti_1p3.Tool.Services.AccessToken (Lti 1p3 v0.6.0)
Link to this section Summary
Functions
Requests an OAuth2 access token. Returns {:ok, %AccessToken{}} on success, {:error, error} otherwise.
Link to this section Types
Link to this section Functions
Link to this function
fetch_access_token(map, scopes, host)
Requests an OAuth2 access token. Returns {:ok, %AccessToken{}} on success, {:error, error} otherwise.
As parameters, expects:
- The registration from which an access token is being requested
- A list of scopes being requested
- The host name of this instance of Torus
examples
Examples
iex> fetch_access_token(registration, scopes, host)
{:ok,
%Lti_1p3.Tool.Services.AccessToken{
"scope" => "https://purl.imsglobal.org/spec/lti-ags/scope/lineitem",
"access_token" => "actual_access_token",
"token_type" => "Bearer",
"expires_in" => "3600"
}
}
iex> fetch_access_token(bad_tool)
{:error, "invalid_scope"}