gandalf v0.2.0 Gandalf.GrantType.Password

Password grant type for OAuth2 Authorization Server

Summary

Functions

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

Functions

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 Gandalf.Model.Token struct, otherwise {:error, Map, :http_status_code}.

Examples

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

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