View Source PatreonEx (PatreonEx v0.1.1)
This module contains functions that access the Patreon API V2 endpoints and functions that generate OAuth URLs and authenticate responses.
Link to this section Summary
Functions
This function is the same as authorize_url/3
but generates a URL that asks
users for permission for all scopes.
This function generates a OAuth2 redirect URL that takes your users to a Patreon login page. After logging in your users will be redirected to a page of your choosing.
This function is wraps a request to the identity
endpoint.
This function is wraps a request to the identity
endpoint.
This function is validates the URL parameter code
that the user is
redirected to after logging in. Your application needs to retrieve the
code
from the URL and pass it to this command.
Link to this section Functions
This function is the same as authorize_url/3
but generates a URL that asks
users for permission for all scopes.
Returns string
examples
Examples
authorize_url("https://google.com", "your_client_id")
@spec authorize_url([binary()], binary(), binary()) :: binary()
@spec authorize_url([binary()], binary(), binary()) :: binary()
This function generates a OAuth2 redirect URL that takes your users to a Patreon login page. After logging in your users will be redirected to a page of your choosing.
Returns string
examples
Examples
authorize_url([identity, campaigns], "https://google.com", "your_client_id")
This function is wraps a request to the identity
endpoint.
Returns map
examples
Examples
get_campaigns(
"access_token_here",
%{
"include" => "tiers",
"fields[campaign]" => Enum.join(["vanity", "creation_name", "discord_server_id", "image_url", "is_nsfw", "url"], ","),
"fields[tier]" => Enum.join(["title", "description"], ",")
}
)
This function is wraps a request to the identity
endpoint.
Returns map
examples
Examples
get_user(
"access_token_here",
%{
"include" => "memberships.currently_entitled_tiers",
"fields[user]" => Enum.join(["about", "hide_pledges", "full_name", "image_url", "thumb_url", "url"], ","),
"fields[tier]" => Enum.join(["title", "description"], ",")
}
)
validate_code(validation_code, redirect_uri, client_id, client_secret)
View SourceThis function is validates the URL parameter code
that the user is
redirected to after logging in. Your application needs to retrieve the
code
from the URL and pass it to this command.
If validation is successful, then Patreon will return an access token that you can use to make API calls.
Returns map
examples
Examples
validate_code("your code param from url", "https://google.com", "your client id", "your client secret")