Pocketeer v0.1.4 Pocketeer.Auth
Authorization module to fetch request_token
and access_token
from the Pocket API necessary to retrieve, modify or access items.
Summary
Functions
Returns authorization URL for Pocket to authorize the application
Returns authorization URL for Pocket to authorize the application
Requests an access token from the Pocket API
Requests an access token from the Pocket API
Sends a request to fetch a request_token
from Pocket
Sends a request to fetch a request_token
from Pocket
Functions
Specs
authorize_url(map) :: String.t
Returns authorization URL for Pocket to authorize the application.
Examples
iex> Pocketeer.Auth.authorize_url(%{request_token: "abcd", redirect_uri: "http://example.com"})
"https://getpocket.com/auth/authorize?request_token=abcd&redirect_uri=http%3A%2F%2Fexample.com"
Parameters
- A struct with
request_token
andredirect_uri
present.
Returns authorization URL for Pocket to authorize the application.
Examples
iex> Pocketeer.Auth.authorize_url("abcd", "http://example.com")
"https://getpocket.com/auth/authorize?request_token=abcd&redirect_uri=http%3A%2F%2Fexample.com"
Parameters
request_token
: The request token to authorize the app withredirect_uri
: The URL the user is redirected to after authorization
Returns the authorization URL with all parameters
Specs
get_access_token(map) ::
{:ok, map} |
{:error, HTTPError.t}
Requests an access token from the Pocket API.
The method requires a request_token
fetched from Pocketeer.Auth.get_request_token
method.
Examples
Pocketeer.Auth.get_access_token(%{consumer_key: "abcd", request_token: "1234"})
{:ok, Response{}}
Specs
get_access_token(String.t, String.t) ::
{:ok, Pocketeer.Response.t} |
{:error, HTTPError.t}
Requests an access token from the Pocket API.
The method requires a request_token
fetched from Pocketeer.Auth.get_request_token
method.
Examples
Pocketeer.Auth.get_access_token("abcd", "1234")
{:ok, Response{}}
Parameters
consumer_key
: The consumer key used from the Pocket APIrequest_token
: The request token to authorize the application
Specs
get_request_token(map) ::
{:ok, Pocketeer.Response.t} |
{:error, HTTPError.t}
Sends a request to fetch a request_token
from Pocket.
Examples
options = %{consumer_key: "1234", redirect_uri: "http://example.com"}
Pocketeer.Auth.get_request_token(options)
Specs
get_request_token(String.t, String.t) ::
{:ok, Pocketeer.Response.t} |
{:error, HTTPError.t}
Sends a request to fetch a request_token
from Pocket.
Examples
Pocketeer.Auth.get_request_token("1234", "http://example.com")
Parameters:
consumer_key
: The consumer key used from the Pocket APIredirect_uri
: URL to redirect when the authorization process has been completed