authable v0.9.1 Authable.GrantType.Password

Password grant type for OAuth2 Authorization Server

Link to this section Summary

Functions

Authorize client for ‘resouce owner’ using resouce owner credentials and client identifier

Link to this section Functions

Link to this function authorize(arg1)

Authorize client for ‘resouce owner’ using resouce owner credentials and client identifier.

For authorization, authorize function requires a map contains ‘email’ and ‘password’, ‘scope’ and ‘client_id’. With valid credentials; it automatically creates access_token and refresh_token(if enabled via config) then it returns Authable.Model.Token struct, otherwise {:error, Map, :http_status_code}.

Examples

Authable.GrantType.Password.authorize(%{
  "email" => "foo@example.com",
  "password" => "12345678",
  "client_id" => "52024ca6-cf1d-4a9d-bfb6-9bc5023ad56e",
  "scope" => "read"
%})

Authable.GrantType.Password.authorize(%{
  "email" => "foo@example.com",
  "password" => "12345678",
  "client_id" => "52024ca6-cf1d-4a9d-bfb6-9bc5023ad56e"
%})