Collection of OK workflows for PAL.
For details, read the OK documentation.
You can configure the workflow by passing options below into pal:new/2
or pal:group/2
functions:
client_id
(required) - The client ID obtained from the email after the application would be created.client_secret
(required) - The client secret obtained from the email after the application would be created.redirect_uri
(required) - The client redirection endpoint. After completing its interaction with the resource owner, the authorization server directs the resource owner's user-agent to this uri.scope
(optional) - A list of requested permissions.request_options
(optional) - Options for the hackney HTTP client.includes
(optional) - Parts of authentication schema to be processed by this workflow. All by default,[uid, credentials, info, extra, rules]
.
Application can be created on that page.
code
- The authorization code.state
- The state previously passed to the authentication provider.error
When request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid.
An successful execution of pal:authenticate/{2,3}
function returns
the authentication schema below.
#{access_token => <<"...">>,
token_type => <<"session">>,
refresh_token => <<"...">>,
expires_in => 1800}
See a complete example with PAL and Cowboy HTTP server here.
You can configure the workflow by passing options below into pal:new/2
or pal:group/2
functions:
application_key
(required) - The application key obtained from the email after the application would be created.request_options
(optional) - Options for the hackney HTTP client.includes
(optional) - Parts of authentication schema to be processed by this workflow. All by default,[uid, credentials, info, extra, rules]
.
Application can be created on that page.
access_token
- The access token obtained using thepal_ok_oauth2_authcode
workflow.
An successful execution of pal:authenticate/{2,3}
function returns
the authentication schema below.
#{uid => <<"...">>,
info =>
#{name => <<"John Doe">>,
first_name => <<"John">>,
last_name => <<"Doe">>,
gender => <<"male">>,
email => <<"[email protected]">>,
image => <<"https://i508.mycdn.me/image...">>,
uri => <<"https://ok.ru/profile...">>}}
See a complete example with PAL and Cowboy HTTP server here.
The source code is provided under the terms of the MIT license.