Contents






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Usage & Examples

Before Getting Started

Before using this plugin, you should first Register an API Client with Patreon.

This plugin supports a few different authentication flows with different trade-offs.

1. Simple & Automatic

This is for you if you just want to check that your users are members of your campaign and find out which tiers/benefits they are entitled to. This allows you to easily do things like unlock specific in-game content for users pledged to specific tiers, display information to the user about their subscription, etc.

Simple Setup

2. Custom

If your needs are more complex, for example maybe you are building an MMO or competitive online shooter and have your own account system you need to link to Patreon, or perhaps you already have your own web service which connects to Patreon and just need to be able to pull specific data out of it from the game client.

Going this route is more complex, but allows you to customize exactly where your tokens are stored, the data fetched from Patreon, how that gets tied into whatever other user data you may have, etc.

Custom Setup


Running the examples

There is a demo map to show basic functionality in: Plugins/NBPatreonAPIClient Content/Examples/Maps/LoginDemo

However, if you run this map you will notice that the login buttons fail with the error:

PatreonAPIClient: Error: Cannot perform authentication: No valid client ID was given!

This is because you have not yet provided your Patreon client ID and secret.

The blueprints for the UI in the demo map are located in:

Plugins/NBPatreonAPIClient Content/Examples/UI/WBP_PatreonLogin_WebBrowser

Plugins/NBPatreonAPIClient Content/Examples/UI/WBP_PatreonLogin_UMGBrowser

Open these and enter the blueprint graph, where you will see the Client ID and Client Secret fields need to be filled in.

Enter the values for the application you created in Patreon, run the LoginDemo map, and it should now allow you to sign in!

It is up to you to decide how to store and handle the Client ID and Client Secret. You could store these as encrypted strings which are only decrypted just before using them, or you might store them outside of your application somewhere and only fetch/download them when needed, etc. If you are developing an open-source project, under no circumstance should you commit these strings to source control.

NOTE: If you sign in with the same Patreon account used to create and manage your campaign, you will not see any entitled tiers. This is normal. To fully test what your users will see, you will need to create a second Patreon account which subscribes to your campaign.

Also note that the user info received from patreon includes a flag which allows you to identify if the user is the creator of the campaign or not. If you are unlocking content for users pledged to specific tiers, you could also use the IsCreator field to unlock everything and enable testing of unlocked content when signed in with your regular creator account.

For an example of accessing and reading information about the Patreon user, see: Plugins/NBPatreonAPIClient Content/Examples/UI/WBP_PatreonUserInfo

Pages






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Registering an API Client

Before you can use the Patreon API, you need to create an application client and API keys for your campaign.

  1. Navigate to: https://www.patreon.com/portal/registration/register-clients

  2. Click the Create Client button

  3. You must set the Client API Version to 2, and fill in the App Name, Description, and Redirect URIs fields.

    The value used in the Redirect URIs field depends on how you plan to configure and use the plugin (below). You can edit this value at any time later if necessary.

    If you plan to handle everything within the game client, then the game client will expect the redirect at http://localhost:8080/login by default. This can be customized, though.

    If you plan to use your own web service to proxy the authentication, then the Redirect URI should point to your web server.

Once you have created a Client, you will need the Client ID and Client Secret.

Do not use the Creator's Access Token!!






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Simple Setup & Usage

This is the simplest approach, but it requires that your Client ID and Client Secret be built into your application or are somehow retrievable by your application at run-time. While you can take steps to make extracting these from your project difficult (e.g. only storing encrypted strings which are decrypted at run-time), there will always be a risk that one of your users will be able to locate and extract them.

Your Redirect URI in your registered client should start with http://localhost

The process will work like this:

  1. You open the Patreon login and consent page for your user (either using their default web browser or the UMG Web Browser widget).
  2. While they are signing in and granting your application access to their data, we start up an HTTP server a. By default the server will listen for a request at http://localhost/login:8080, but you can customize this as you see fit b. Whatever you configure the server to use, you need to ensure that your application's configuration on the Patreon side has a matching Redirect URI, e.g. if you set Callback Route to /patreon and Callback Port to 9999, you must update the settings in Patreon to include a Redirect URI of http://localhost:9999/patreon.

    The Callback Route MUST start with "/" and be longer than just "/" but can otherwise be anything you want.

    The Callback Port MUST be a positive integer, and unless you plan to use port 80 should be larger than 1024

  3. After consenting to sharing their data with your application, Patreon will make a request to the built-in HTTP server with a one-time use code we use to obtain an Access Token on behalf of the user.
  4. Once we have an access token, we use this to request the user's account information, including any tiers and benefits they are entitled to.
  5. You can then use this information as you want, e.g. checking if they are pledged to a specific tier and unlocking some content for them.

That sounds like a lot, but steps 1-3 are encapsulated inside of a single function which can be chained to a second function to handle step 4 for you, leaving only the actual logic for your application in step 5 up to you to implement.

Blueprint

Authentication & Checking for a tier

C++

#include "Actions/PerformAuthenticationAsyncAction.h"
#include "Actions/GetPatreonUserInfoAsyncAction.h"
#include "APITokenInfo.h"

#define CLIENT_ID     TEXT("<Your Client ID>")
#define CLIENT_SECRET TEXT("<Your Client Secret>")

void MyClass::DoPatreonLogin() {
  // create an authentication action expecting a callback at http://localhost/login:8080
  UPerformAuthenticationAsyncAction* authAction = UPerformAuthenticationAsyncAction::PerformAuthenticationAsyncAction(
    this, // world context
    CLIENT_ID,
    CLIENT_SECRET
    // callback route defaults to "/login"
    // callback port defaults to 8080
  );

  // register callbacks for results
  authAction->OnComplete.AddDynamic(this, &MyClass::OnAuthenticationComplete);
  authAction->OnFail.AddDynamic(this, &MyClass::OnAuthenticationFailed);
  // kick off action
  authAction->Activate();
}

void MyClass::OnAuthenticationComplete(FAPITokenInfo TokenInfo) {
  // now that we have a token, we can use it to fetch information about the user who just logged in
  UGetPatreonUserInfoAsyncAction* getInfoAction = UGetPatreonUserInfoAsyncAction::GetPatreonUserInfoAsyncAction(
    this, // world context
    TokenInfo
  );

  getInfoAction->OnComplete.AddDynamic(this, &MyClass::OnGetUserInfoComplete);
  getInfoAction->OnFail.AddDynamic(this, &MyClass::OnGetUserInfoFail);
  getInfoAction->Activate();
}

void MyClass::OnAuthenticationFailed() {
  UE_LOG(LogTemp, Error,
    TEXT("Patreon authentication failed: The user may have denied the request for their data")
  );
}

void MyClass::OnGetUserInfoComplete(FPatreonUserInfo UserInfo) {
  // now that we have the user's information,
  //  we can check if they have pledged to a tier with unlockable content
  if (UserInfo.HasTier("Special Tier")) {
    UnlockSecretConent();
  } else  {
    // suggest the user should pledge to the Special Tier ;)
  }
}

void MyClass::OnGetUserInfoFail() {
  UE_LOG(LogTemp, Error,
    TEXT("Fetching user info from Patreon API failed: Was the access token invalid?")
  );
}






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Custom Setup & Usage

If you plan to run your own web server to handle part or all of the authentication and communication with Patreon's API, then this section is for you.

Why do it this way?

If you have your own account system (e.g. maybe you are developing a MMO) then it may make the most sense to associate your users' accounts with their Patreon accounts and store their access tokens alongside the other account data you have for them. In this way, you would just need to ask them to connect their Patreon account to your servers once, then when they login to your game client you can send their Patreon info alongside whatever other account details your game receives.

Alternatively, if you are concerned about the security of your Patreon Client Secret, the only completely reliable way to prevent your users from ever being able to extract it is to prevent the application from ever seeing it in the first place. Even without your own account system, you could still run a web service which just handles the code exchange to get an access token after a user logs in to Patreon, then either ask the user to copy-and-paste this into the game or cache the access tokens on your server and provide an API to fetch them.

If you find that the information we retrieve from the Patreon API in Get User Info is insufficient for your use case, then you may also want to go the custom route to make the specific API requets you need (if you find yourself going down this road, though, please drop me a note so I can consider supporting your use case better by default in the future).

Several BP nodes for making HTTP requests are provided for those who prefer to work entirely in blueprints, and helpers are provided for C++ developers to simplify things from that side as well. If you feel there is anything missing to enable the workflow you want to implement, or anything could be added to help make your life easier when implementing a custom solution, please feel free to let me know!

Example

As an example, let's say you just want to protect your Client Secret, so you have a web server somewhere which can receive the authentication callback from Patreon after a user signs in and accepts to sharing data with your applicatoin.

First, the authentication & consent page the user gets sent to must be parameterized with a Redirect URI pointing at your server. There are several nodes to make this easier from blueprint:

Custom Auth Page

Because the user will be redirected to your web server, the game client will not be able to know when the authentication has completed and a new access token is available.

Some people will simply display the access token on the redirect page and ask the user to copy-and-paste it into a text field in the game. If you want to avoid this and make the experience a little more automatic and seamless, though, you can create and send a unique ID with your request (the Patreon Auth Id in the image above). This value will also be sent to the redirect URL as a state query param, so both the game client and your server have the same Id which can be used to tie the two requests together. See Patreon's documentation for more information.

In the example above we are creating a new Id string for every request, but if you have another way of identifying your users (e.g. if you have your own account service this could be their user ID or some other identifying string you create for them). Once the user returns to the game client, you can then send another request to your server asking for their access token, passing the same Id so the server can look it up among all the patreon users it has processed:

Custom Fetch User Info




For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Troubleshooting

Logs

All logs produced by this plugin are created under the PatreonAPIClient log category

Log Category

C++ Headers

If you are working in C++ and keep getting "File not found" errors when attempting to include headers from this plugin, make sure you have added the plugin as a dependency for your project in your Build.cs file:

public class MyModule : ModuleRules
{
	public MyModule(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

        // \/  Add NBPatreonAPIClient as a dependency to allow access to plugin header files, etc.
		PrivateDependencyModuleNames.AddRange(new string[] { "NBPatreonAPIClient" });
	}
}






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Blueprint API Documentation

An overview and explanation of all included Blueprint nodes

Functions

Structs

Pages






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Blueprint Functions

Pages






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: PerformAuthentication

Perform Authentication Node


Performs OAuth login to Patreon and requests the user's consent to share data with your application using the user's default web browser.

The returned access token can be used to make additional requests to the Patreon API, e.g. to obtain information about the authenticated user and their pledges to determine if specific in-game content should be unlocked for them.


Inputs

  • Client ID

    string

    Your Patreon app client_id.

  • Client Secrent

    string

    Your Patreon app client_secret.

  • Callback Route

    string

    [optional] The URL to request the authentication callback at. Must match the redirect URI you set in your patreon app config.

  • Callback Port

    int

    [optional] The port to listen on for the authentication callback. Must match the redirect URI you set in your patreon app config.

Outputs

  • Main Execution Pin (at the top)

    Execution will immediately continue from this pin while the authentication process continues in the background. Do not use execution flowing from this pin to check for the results, they aren't ready yet!

  • Async Action

    This is a reference to the action running in the background. You can use this to cancel the async action if you decide you actually don't need the results before it has completed.

  • On Complete

    When the authentication process has been completed successfully, execution will flow from this pin.

    Token Info should be valid and can be used at this point.

  • On Fail

    If the authentication process fails for any reason, execution will flow from this pin. You can use this to display an error to the user, prompt them to try again, etc.

    Token Info will be invalid and should not be used!

  • Token Info

    API Token Info

    The user's API access token. This is required for other functions which interact with the Patreon API.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: PerformAuthentication (UMG Browser)

Perform Authentication (UMG Browser) Node


Performs OAuth login to Patreon and requests the user's consent to share data with your application using a UMG WebBrowser widget, so they can complete the entire process without leaving the game.

The returned access token can be used to make additional requests to the Patreon API, e.g. to obtain information about the authenticated user and their pledges to determine if specific in-game content should be unlocked for them.


Inputs

Outputs

  • Main Execution Pin (at the top)

    Execution will immediately continue from this pin while the authentication process continues in the background. Do not use execution flowing from this pin to check for the results, they aren't ready yet!

  • Async Action

    This is a reference to the action running in the background. You can use this to cancel the async action if you decide you actually don't need the results before it has completed.

  • On Complete

    When the authentication process has been completed successfully, execution will flow from this pin.

    Token Info should be valid and can be used at this point.

  • On Fail

    If the authentication process fails for any reason, execution will flow from this pin. You can use this to display an error to the user, prompt them to try again, etc.

    Token Info will be invalid and should not be used!

  • Token Info

    API Token Info

    The user's API access token. This is required for other functions which interact with the Patreon API.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: Refresh API Token

Perform Authentication (UMG Browser) Node


If an access token expires, this node can be used to handle the token refresh process and obtain a new access token without requiring the user to login again. This requires that you have saved the Refresh Token which was obtained along with the original access token.


Inputs

Outputs

  • Main Execution Pin (at the top)

    Execution will immediately continue from this pin while the authentication process continues in the background. Do not use execution flowing from this pin to check for the results, they aren't ready yet!

  • Async Action

    This is a reference to the action running in the background. You can use this to cancel the async action if you decide you actually don't need the results before it has completed.

  • On Complete

    When the refresh process has been completed successfully, execution will flow from this pin.

    Token Info should be valid and can be used at this point.

  • On Fail

    If the authentication process fails for any reason, execution will flow from this pin. You can use this to display an error to the user, prompt them to login to Patreon again, etc.

    Token Info will be invalid and should not be used!

  • Token Info

    API Token Info

    The new API access token.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: Get User Info

Get User Info Node


Retrieves information about a Patreon user. Can be used to check if they are subscribed to a specific tier in order to unlock content, display information about their subscription, etc.

Requires an access token obtained by some authentication method.


Inputs

Outputs

  • Main Execution Pin (at the top)

    Execution will immediately continue from this pin while the authentication process continues in the background. Do not use execution flowing from this pin to check for the results, they aren't ready yet!

  • Async Action

    This is a reference to the action running in the background. You can use this to cancel the async action if you decide you actually don't need the results before it has completed.

  • On Complete

    When the user's data has been successfully fetched, execution will flow from this pin.

    User Info should be valid and can be used at this point.

  • On Fail

    If the process fails for any reason, execution will flow from this pin. You can use this to display an error to the user, prompt them to try again, etc.

    User Info will be invalid and should not be used!

  • User Info

    Patreon User Info

    Information about the user and their subscription status. Will only be valid via the On Complete execution pin.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: Get User Info (w/ images)

Get User Info Node


Fetches information about the user and their subscriptions, AND downloads any associated images (e.g. their avatar image) and makes them available as a texture which can be used in UMG. This is a little bit slower than Get User Info because we may need to make several additional requests to download the images, but once this action completes you can be sure that all related images are available and ready to use.

If any user or tier does not have an associated image (e.g. because you never created a header image for your tiers) then we will not make any additional requests for them and the textures will be null.


Inputs

Outputs

  • Main Execution Pin (at the top)

    Execution will immediately continue from this pin while the authentication process continues in the background. Do not use execution flowing from this pin to check for the results, they aren't ready yet!

  • Async Action

    This is a reference to the action running in the background. You can use this to cancel the async action if you decide you actually don't need the results before it has completed.

  • On Complete

    When the user's data has been successfully fetched, execution will flow from this pin.

    User Info should be valid and can be used at this point.

  • On Fail

    If the process fails for any reason, execution will flow from this pin. You can use this to display an error to the user, prompt them to try again, etc.

    User Info will be invalid and should not be used!

  • User Info

    Patreon User Info Imgs

    Information about the user and their subscription status.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: HTTP Request

Perform Authentication (UMG Browser) Node


A generic HTTP request. Can be used to fetch web pages, content from REST APIs (e.g. to obtain Patreon data not currently supported by the other nodes), etc.


Inputs

  • URI

    String

    URI to request.

  • Verb

    String

    HTTP method, e.g. GET, POST, PUT, etc.

  • Payload

    String

    Additional payload data to include with the request. How this is handled depends on Verb.

    For example, if Verb is GET, then the payload will be appended to the URI as URL params. If the Verb is POST, the payload will be included in the request body.

  • Headers

    Map of Strings to Strings

    Optional. Any entries included here will be added to the headers of the request.

Outputs

  • Main Execution Pin (at the top)

    Execution will immediately continue from this pin while the authentication process continues in the background. Do not use execution flowing from this pin to check for the results, they aren't ready yet!

  • Async Action

    This is a reference to the action running in the background. You can use this to cancel the request if you decide you actually don't need the results before it has completed.

  • On Complete

    When the request has completed successfully, execution will flow from this pin.

  • On Fail

    If the authentication process fails for any reason, execution will flow from this pin.

  • Response Code

    Integer

    The HTTP response code the request returned.

  • Response String

    String

    The response content as a string.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: HTTP Request (with bearer token)

Perform Authentication (UMG Browser) Node


This is equivalent to the basic HTTP Request, but it will automatically add the Authorization header required for requests with a bearer token (e.g., the requests to the Patreon API). It's a small convenience compared to always including this header in your requests.


Inputs

  • URI

    String

    URI to request.

  • Verb

    String

    HTTP method, e.g. GET, POST, PUT, etc.

  • Payload

    String

    Additional payload data to include with the request. How this is handled depends on Verb.

    For example, if Verb is GET, then the payload will be appended to the URI as URL params. If the Verb is POST, the payload will be included in the request body.

  • Access Token

    String

    The access token to use for request authorization, e.g. the Access Token from API Token Info.

  • Headers

    Map of Strings to Strings

    Optional. Any entries included here will be added to the headers of the request. Including additional headers here will not affect the Authorization header automatically added to the request.

Outputs

  • Main Execution Pin (at the top)

    Execution will immediately continue from this pin while the authentication process continues in the background. Do not use execution flowing from this pin to check for the results, they aren't ready yet!

  • Async Action

    This is a reference to the action running in the background. You can use this to cancel the request if you decide you actually don't need the results before it has completed.

  • On Complete

    When the request has completed successfully, execution will flow from this pin.

  • On Fail

    If the authentication process fails for any reason, execution will flow from this pin.

  • Response Code

    Integer

    The HTTP response code the request returned.

  • Response String

    String

    The response content as a string.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: HTTP GET

Perform Authentication (UMG Browser) Node


Performs a basic HTTP GET request without any other options.


Inputs

Outputs

  • Main Execution Pin (at the top)

    Execution will immediately continue from this pin while the authentication process continues in the background. Do not use execution flowing from this pin to check for the results, they aren't ready yet!

  • Async Action

    This is a reference to the action running in the background. You can use this to cancel the request if you decide you actually don't need the results before it has completed.

  • On Complete

    When the request has completed successfully, execution will flow from this pin.

  • On Fail

    If the authentication process fails for any reason, execution will flow from this pin.

  • Response Code

    Integer

    The HTTP response code the request returned.

  • Response String

    String

    The response content as a string.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: HTTP POST

Perform Authentication (UMG Browser) Node


Performs an HTTP POST request.


Inputs

Outputs

  • Main Execution Pin (at the top)

    Execution will immediately continue from this pin while the authentication process continues in the background. Do not use execution flowing from this pin to check for the results, they aren't ready yet!

  • Async Action

    This is a reference to the action running in the background. You can use this to cancel the request if you decide you actually don't need the results before it has completed.

  • On Complete

    When the request has completed successfully, execution will flow from this pin.

  • On Fail

    If the authentication process fails for any reason, execution will flow from this pin.

  • Response Code

    Integer

    The HTTP response code the request returned.

  • Response String

    String

    The response content as a string.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: Make Patreon Auth URI

Make Patreon Auth URI


Constructs a URI to the Patreon login/consent page.

This is the page the user must visit in order to authenticate with Patreon and generate a new access token.


Inputs

  • Client ID

    String

    You patreon app Client ID

  • Callback URI

    String

    The URI the user's browser should redirect to after authenticating with Patreon. This must match the Redirect URI set in your Patreon app settings.

  • Id

    String

    An optional string which will be appended to the login URI. After authentication, this string will be included in the callback to Callback URI. This can be used to match the response to a specific request, associate a non-Patreon user ID with a new user's access token, etc.

Outputs






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: Open URL

Open URL Node


Opens a given URL in the user's default web browser.


Inputs

Outputs






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Function: Parse API Token Info

Get User Info Node


Parses an API Token Info from a JSON String.

It is expected that the JSON string will be of the form:

{
  "access_token"  : <single use token>,
  "refresh_token" : <single use token>,
  "expires_in"    : <token lifetime duration>,
  "scope"         : <token scopes>,
  "token_type"    : "Bearer"
}

Inputs

Outputs

  • Token Info

    API Token Info

    The parsed token, if the input string could be parsed.

  • Success

    bool

    True if the parsing was successful, otherwise False. If this value is False, Token Info should not be used and will be invalid.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Pages






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Struct: API Token Info

C++ StructFAPITokenInfo

API Token Info Node


Stores an API access token and related information


Properties

  • Access Token

    String

    Access token used to make authenticated requests (e.g. retrieve user identity info). This is usually obtained via oath.

  • RefreshToken

    String

    When the Access Token expires, this token can be used to request a new access token without requiring the user to login again.

  • Scopes

    String

    The scopes Access Token is allowed to access. This may differ from the scopes which were requested during authentication.

  • TokenLifetime

    TimeSpan

    The time (in seconds) after TokenReceived that the Access Token is valid.

  • TokenReceived

    DateTime

    The time (UTC) Access Token and Refresh Token were received. This is used to check if the Access Token is still valid before attempting to use it.

Functions

  • Is API Token Valid

    Is Valid


    Checks if an API token is valid.

    This verifies that the Access Token field is set, and that the token has not yet expired.


    Inputs

    Returns

    True if the token is valid and can be used, otherwise, False.

  • Has API Token Expired

    Is Valid


    Checks if an API token has expired.

    Compares the current time to the time the token was received + the token's lifetime. Tokens are typically valid for ~30 days.


    Inputs

    Returns

    True if the token is expired and needs to be replaced/refreshed, otherwise, False.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Struct: Patreon User Info

C++ StructFPatreonUserInfo

Patreon User Info Node


Stores information related to a user and their subscription(s).


Properties

  • First Name

    String

    Ther user's first name (may be empty).

  • Last Name

    String

    Ther user's last name (may be empty).

  • Full Name

    String

    The user's full name (usually the combination of First Name and Last Name but may be different).

  • Vanity Name

    String

    The user's preferred nickname, if they have set one (may be empty).

  • Image URL

    String

    A URL pointing to the user's avatar image

  • Patron Status

    String

    Indicates the user's current pledge status for your campaign.

    ValueMeaning
    active_patronThey are currently subscribed to your campaign
    declined_patronThey have attempted to subscribe, but payment failed
    former_patronThey used to subscribe, but currently do not
    emptyThis user has never subscribed to your campaign before
  • Tiers

    Array of Patreon Tier Info

    A list of all the tiers this user is currently entitled to with their subscription. This will often include multiple entries even if they have only pledged to a single tier, as pledging to a higher tier can include all tiers below it.

  • Can See NSFW

    Bool

    If true, then this user has enabled NSFW content in their Patreon account.

  • Is Creator

    Bool

    If true, then this user is also the creator of the campaign!

    If you are testing this plugin with your creator account, then this will always be true, and you may see some other differences when using that account vs. a regular subscriber account (e.g., the creator typically has no entitled tiers, the scopes enabled on your access token after logging in may be different, etc.).

    This property is mainly here to allow for a sanity check in cases like that, but you could also use it to make a 'creator-only' test mode, for example if you are unlocking certain content at certain tiers you could set ALL content to unlock for the creator account to let you test the unlocked behavior of everything everywhere all at once.

Functions






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Struct: Patreon User Info Imgs

Patreon User Info Node


Stores information related to a user and their subscription(s).

Includes images (e.g. the user's avatar) as usable textures rather than URLs, so they can be directly added to the UI.


Properties

  • First Name

    String

    Ther user's first name (may be empty).

  • Last Name

    String

    Ther user's last name (may be empty).

  • Full Name

    String

    The user's full name (usually the combination of First Name and Last Name but may be different).

  • Vanity Name

    String

    The user's preferred nickname, if they have set one (may be empty).

  • Avatar Image

    Texture 2DDynamic

    The user's avatar image, can be used directly in UMG to display it.

  • Patron Status

    String

    Indicates the user's current pledge status for your campaign.

    ValueMeaning
    active_patronThey are currently subscribed to your campaign
    declined_patronThey have attempted to subscribe, but payment failed
    former_patronThey used to subscribe, but currently do not
    emptyThis user has never subscribed to your campaign before
  • Tiers

    Array of Patreon Tier Info Imgs

    A list of all the tiers this user is currently entitled to with their subscription. This will often include multiple entries even if they have only pledged to a single tier, as pledging to a higher tier can include all tiers below it.

  • Can See NSFW

    Bool

    If true, then this user has enabled NSFW content in their Patreon account.

  • Is Creator

    Bool

    If true, then this user is also the creator of the campaign!

    If you are testing this plugin with your creator account, then this will always be true, and you may see some other differences when using that account vs. a regular subscriber account (e.g., the creator typically has no entitled tiers, the scopes enabled on your access token after logging in may be different, etc.).

    This property is mainly here to allow for a sanity check in cases like that, but you could also use it to make a 'creator-only' test mode, for example if you are unlocking certain content at certain tiers you could set ALL content to unlock for the creator account to let you test the unlocked behavior of everything everywhere all at once.

Functions






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Struct: Patreon Tier Info

C++ StructFPatreonTierInfo

Patreon Tier Info Node


Stores information about a specific pledge tier.


Properties

  • Title

    String

    The tier title you set in Patreon

  • Description

    String

    The tier description you set in Patreon

  • Image URL

    String

    If the tier has a header image set in Patreon, this will contain the URL to that image.

  • URL

    String

    The URL of the tier, itself. Can be used to link to the pledge page.

  • Benefits

    Array of String

    If any benefits are associated with this tier, their Titles are included here.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

BP Struct: Patreon Tier Info Imgs

Patreon User Info Node


Stores information about a specific pledge tier.

Includes tier header images as textures ready to use in UMG.


Properties






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

C++ API Reference

Structs

Classes

Delegates






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Structs






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Struct: FAPITokenInfo

//  APITokenInfo.h : 9

struct NBPATREONAPICLIENT_API FAPITokenInfo;

Reflection-enabled

Specifiers:

  • BlueprintType

Stores an API access token and related information.


Properties

  • AccessToken

    public:
    FString AccessToken;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Token

    Access token used to make authenticated requests (e.g. retrieve user identity info). This is usually obtained via oath.
  • RefreshToken

    public:
    FString RefreshToken;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Token

    When the AccessToken expires, this token can be used to request a new access token without requiring the user to login again.
  • Scopes

    public:
    FString Scopes;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Token

    The scopes AccessToken is allowed to access. This may differ from the scopes which were requested during authentication.
  • TokenLifetime

    public:
    FTimespan TokenLifetime;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Token

    The time (in seconds) after TokenReceived that the AccessToken is valid. If `FDateTime::Now() - (TokenReceived + TokenLifetime)` is < 0, the **`Self::AccessToken`** has expired.
  • TokenReceived

    public:
    FDateTime TokenReceived;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Token

    The time (UTC) AccessToken and RefreshToken were received. This is used to check if the AccessToken is still valid before attempting to use it.

Constructors


Methods

  • HasTokenExpired

    //  APITokenInfo.h : 61
    
    public:
    bool HasTokenExpired() const;
    

    Checks if a token's lifetime has expired.


    Returns

    • bool
      
  • IsValid

    //  APITokenInfo.h : 68
    
    public:
    bool IsValid() const;
    

    Checks that there is an access token which has not yet expired. Does not check the refresh token.


    Returns

    • bool
      
  • RemainingLifetime

    //  APITokenInfo.h : 56
    
    public:
    FTimespan RemainingLifetime() const;
    

    Computes the time remaining (from now) before the token expires.


    Returns

    • FTimespan
      






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Struct: FPatreonTierInfo

//  PatreonTierInfo.h : 13

struct NBPATREONAPICLIENT_API FPatreonTierInfo;

Reflection-enabled

Specifiers:

  • BlueprintType

Represents basic information about a pledged tier.

This can be used to show the user information about the benefits or content they are now able to unlock, or just to check which content should be unlocked behind the scenes.


Properties

  • Benefits

    public:
    TArray<FString> Benefits;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Tier

    List of benefits this tier provides.

    If you have multiple tiers which provide the same benefit, it may be more straightforward to simply check if any tier contains a particular benefit to unlock content rather than checking for multiple tiers at once.

  • Description

    public:
    FString Description;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Tier

    Short description of the tier, may be empty
  • ImageURL

    public:
    FString ImageURL;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Tier

    URL of the tier's main image (if it has one).

    For convenience, FPatreonTierInfoImgs directly includes the image as a texture instead.

  • Title

    public:
    FString Title;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Tier

    The name of this tier
  • URL

    public:
    FString URL;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Tier

    URL of the tier, e.g. to provide a pledge link

Constructors






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Struct: FPatreonTierInfoImgs

//  PatreonTierInfoImgs.h : 12

struct NBPATREONAPICLIENT_API FPatreonTierInfoImgs;

Reflection-enabled

Specifiers:

  • BlueprintType

Provides the same information as FPatreonTierInfo, but rather than containing URLs to images the images are stored directly as Textures.


Properties

  • Benefits

    public:
    TArray<FString> Benefits;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Tier

    List of benefits this tier provides.

    If you have multiple tiers which provide the same benefit, it may be more straightforward to simply check if any tier contains a benefit to unlock content rather than checking for multiple tiers at once.

  • Description

    public:
    FString Description;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Tier

    Short description of the tier, may be empty
  • TierImage

    public:
    UTexture2DDynamic* TierImage;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Tier

    Tier's main image as a texture, can be directly used in a UMG widget.
  • Title

    public:
    FString Title;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Tier

    The name of this tier
  • URL

    public:
    FString URL;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|Tier

    URL of the tier, e.g. to provide a pledge link

Constructors






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Struct: FPatreonUserInfo

//  PatreonUserInfo.h : 17

struct NBPATREONAPICLIENT_API FPatreonUserInfo;

Reflection-enabled

Specifiers:

  • BlueprintType

Contains basic information about a user obtained from the Patreon API. This is meant as a convenience to cover the information most applications might need(e.g.to display to the user their pledge status or to unlock specific content based on the tiers they've pledged to). If any information you need about a user is not included here, you can still extract that information manually from an API request or submit a feature request for this plugin to nbpsup@gmail.com


Properties

  • CanSeeNSFW

    public:
    bool CanSeeNSFW;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    Whether or not the user has enabled NSFW content on their Patreon profile
  • FirstName

    public:
    FString FirstName;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

  • FullName

    public:
    FString FullName;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

  • ImageURL

    public:
    FString ImageURL;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    URL of the user's avatar image
  • IsCreator

    public:
    bool IsCreator;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    Whether or not the current user is also the creator of the campaign.
  • LastName

    public:
    FString LastName;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

  • PatronStatus

    public:
    FString PatronStatus;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    Can be one of:
    • active_patron: They are currently subscribed to a campaign
    • declined_patron: They have attempted to subscribe, but payment failed!!
    • former_patron: They used to subscribe, but currently do not
    • null: They have never subscribed before
  • Tiers

    public:
    TArray<FPatreonTierInfo> Tiers;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    A list of all tiers this user is entitled to. In many cases this will include not just the specific tier they have pledged to, but also any lower tiers.
  • URL

    public:
    FString URL;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    URL of the user's profile
  • VanityName

    public:
    FString VanityName;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    If set, represents the user's preferred nickname

Constructors

  • FPatreonUserInfo

    //  PatreonUserInfo.h : 25
    
    public:
    FPatreonUserInfo();
    

    Empty constructor does not provide any default values.

  • FPatreonUserInfo

    //  PatreonUserInfo.h : 33
    
    public:
    FPatreonUserInfo(
        const FString& json
    );
    

    Constructs FPatreonUserInfo from a JSON string. Populates any fields it can find in the provided JSON. If the provided json string cannot be parsed for any reason, the result will be uninitialized.


    Arguments

    • json

      const FString& json
      

Methods

  • HasBenefit

    //  PatreonUserInfo.h : 50
    
    public:
    bool HasBenefit(
        const FString& benefitName
    ) const;
    

    Convenience method to check if this user is entitled to a particular benefit. Will check all tiers the user is pledged to.


    Arguments

    • benefitName

      const FString& benefitName
      

      Name of the benefit to check for, case-insensitive


    Returns

    • bool
      

      True if the user is entitled to the given benefit

  • HasTier

    //  PatreonUserInfo.h : 42
    
    public:
    bool HasTier(
        const FString& tierName
    ) const;
    

    Convenience method to check if this user has pledged to a specific tier


    Arguments

    • tierName

      const FString& tierName
      

      Name of the tier to check for, case-insensitive


    Returns

    • bool
      

      True if the user has pledged to the given tier

  • ParseTier

    //  PatreonUserInfo.h : 35
    
    public:
    FPatreonTierInfo ParseTier(
        const TSharedPtr<FJsonObject> tierEntry,
        const TSharedPtr<FJsonObject> tierattributes
    );
    

    Arguments


    Returns

    • FPatreonTierInfo
      






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Struct: FPatreonUserInfoImgs

//  PatreonUserInfoImgs.h : 14

struct NBPATREONAPICLIENT_API FPatreonUserInfoImgs;

Reflection-enabled

Specifiers:

  • BlueprintType

Contains the same information as FPatreonUserInfo, but instead of including URLs to images will include the actual images as a Texture2D.


Properties

  • AvatarImage

    public:
    UTexture2DDynamic* AvatarImage;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    User's avatar
  • CanSeeNSFW

    public:
    bool CanSeeNSFW;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    Whether or not the user has enabled NSFW content on their Patreon profile
  • FirstName

    public:
    FString FirstName;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

  • FullName

    public:
    FString FullName;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

  • IsCreator

    public:
    bool IsCreator;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    Whether or not the current user is also the creator of the campaign.
  • LastName

    public:
    FString LastName;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

  • PatronStatus

    public:
    FString PatronStatus;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    Can be one of:
    • active_patron: They are currently subscribed to a campaign
    • declined_patron: They have attempted to subscribe, but were declined
    • former_patron: They used to subscribe, but currently do not
    • null: They have never subscribed before
  • Tiers

    public:
    TArray<FPatreonTierInfoImgs> Tiers;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    A list of all tiers this user is entitled to. In many cases this will include not just the specific tier they have pledged to, but also any lower tiers.
  • URL

    public:
    FString URL;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    URL of the user's profile
  • VanityName

    public:
    FString VanityName;
    

    Reflection-enabled

    Specifiers:

    • EditAnywhere
    • BlueprintReadWrite
    • Category = NBPatreonAPIClient|User Info

    If set, represents the user's preferred nickname

Constructors


Methods

  • HasBenefit

    //  PatreonUserInfoImgs.h : 36
    
    public:
    bool HasBenefit(
        const FString& benefitName
    ) const;
    

    Convenience method to check if this user is entitled to a particular benefit. Will check all tiers the user is pledged to.


    Arguments

    • benefitName

      const FString& benefitName
      

      Name of the benefit to check for, case-insensitive


    Returns

    • bool
      

      True if the user is entitled to the given benefit

  • HasTier

    //  PatreonUserInfoImgs.h : 28
    
    public:
    bool HasTier(
        const FString& tierName
    ) const;
    

    Convenience method to check if this user has pledged to a specific tier


    Arguments

    • tierName

      const FString& tierName
      

      Name of the tier to check for, case-insensitive


    Returns

    • bool
      

      True if the user has pledged to the given tier






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Classes






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: FNBPatreonAPIClientModule

//  NBPatreonAPIClient.h : 6

class FNBPatreonAPIClientModule
    : public IModuleInterface;


Methods

  • ShutdownModule

    //  NBPatreonAPIClient.h : 11
    
    public:
    virtual void ShutdownModule() override;
    
  • StartupModule

    //  NBPatreonAPIClient.h : 10
    
    public:
    virtual void StartupModule() override;
    






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: UGetPatreonUserInfoAsyncAction

//  GetPatreonUserInfoAsyncAction.h : 19

class NBPATREONAPICLIENT_API UGetPatreonUserInfoAsyncAction
    : public UCancellableAsyncAction;

Reflection-enabled


Retrieves information about a Patreon user. Can be used to check if they are subscribed to a specific tier in order to unlock content, display information about their subscription, etc.

Requires an access token obtained by some authentication method.


Properties

  • OnComplete

    public:
    FGetPatreonUserInfoAsyncActionEvent OnComplete;
    

    Reflection-enabled

    Specifiers:

    • BlueprintAssignable

    Event fired when the task completes successfully
  • OnFail

    public:
    FGetPatreonUserInfoAsyncActionFailedEvent OnFail;
    

    Reflection-enabled

    Specifiers:

    • BlueprintAssignable

    Event fired if the task fails for any reason

Methods

  • Activate

    //  GetPatreonUserInfoAsyncAction.h : 51
    
    public:
    virtual void Activate() override;
    

    Starts the task

  • Cancel

    //  GetPatreonUserInfoAsyncAction.h : 56
    
    public:
    virtual void Cancel() override;
    

    Can be called to cancel the task and prevent callbacks from being called

  • GetPatreonUserInfoAsyncAction

    //  GetPatreonUserInfoAsyncAction.h : 33
    
    public:
    static UGetPatreonUserInfoAsyncAction* GetPatreonUserInfoAsyncAction(
        const UObject* WorldContext,
        FAPITokenInfo TokenInfo
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient

    Meta Specifiers:

    • DisplayName = Get User Info
    • Keywords = NBPatreonAPIClient
    • WorldContext = WorldContext
    • BlueprintInternalUseOnly = true

    Retrieves information about the user corresponding to a specific access token.

    Will fail if the access token is empty, invalid, or expired.


    Arguments

    • WorldContext

      const UObject* WorldContext
      
    • TokenInfo

      FAPITokenInfo TokenInfo
      

      Token information for the user


    Returns

    • UGetPatreonUserInfoAsyncAction*
      






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: UGetPatreonUserInfoImgAsyncAction

//  GetPatreonUserInfoImgAsyncAction.h : 24

class NBPATREONAPICLIENT_API UGetPatreonUserInfoImgAsyncAction
    : public UCancellableAsyncAction;

Reflection-enabled


Retrieves information about a Patreon user, including their avatar image and any images for their pledged tiers.

Can be used to check if they are subscribed to a specific tier in order to unlock content, display information about their subscription, etc.

Requires an access token obtained by some authentication method.


Properties

  • OnComplete

    public:
    FGetPatreonUserInfoImgAsyncActionEvent OnComplete;
    

    Reflection-enabled

    Specifiers:

    • BlueprintAssignable

    Event fired when the task completes successfully
  • OnFail

    public:
    FGetPatreonUserInfoImgAsyncActionFailedEvent OnFail;
    

    Reflection-enabled

    Specifiers:

    • BlueprintAssignable

    Event fired if the task fails for any reason

Methods

  • Activate

    //  GetPatreonUserInfoImgAsyncAction.h : 58
    
    public:
    virtual void Activate() override;
    

    Starts the task

  • Cancel

    //  GetPatreonUserInfoImgAsyncAction.h : 63
    
    public:
    virtual void Cancel() override;
    

    Can be called to cancel the task and prevent callbacks from being called

  • GetPatreonUserInfoImgAsyncAction

    //  GetPatreonUserInfoImgAsyncAction.h : 40
    
    public:
    static UGetPatreonUserInfoImgAsyncAction* GetPatreonUserInfoImgAsyncAction(
        const UObject* WorldContext,
        FAPITokenInfo TokenInfo
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient

    Meta Specifiers:

    • DisplayName = Get User Info (w/ images)
    • Keywords = NBPatreonAPIClient
    • WorldContext = WorldContext
    • BlueprintInternalUseOnly = true

    Retrieves information about the user corresponding to a specific access token, AND fetches any relevant images, e.g. their avatar and images from any pledged tiers.

    Will fail if the access token is empty, invalid, or expired.


    Arguments

    • WorldContext

      const UObject* WorldContext
      
    • TokenInfo

      FAPITokenInfo TokenInfo
      

      Token information for the user


    Returns

    • UGetPatreonUserInfoImgAsyncAction*
      






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: UHTTPRequestAction

//  HTTPRequestAction.h : 13

class NBPATREONAPICLIENT_API UHTTPRequestAction
    : public UCancellableAsyncAction;

Reflection-enabled


Helper to make common HTTP requests a little easier and expose them to blueprints.


Properties

  • OnComplete

    public:
    FHTTPRequestActionEvent OnComplete;
    

    Reflection-enabled

    Specifiers:

    • BlueprintAssignable

    Event fired when the request completes successfully
  • OnFail

    public:
    FHTTPRequestActionEvent OnFail;
    

    Reflection-enabled

    Specifiers:

    • BlueprintAssignable

    Event fired if the request fails for any reason

Methods

  • Activate

    //  HTTPRequestAction.h : 81
    
    public:
    virtual void Activate() override;
    

    Starts the task

  • Cancel

    //  HTTPRequestAction.h : 86
    
    public:
    virtual void Cancel() override;
    

    Can be called to cancel the task and prevent callbacks from being called

  • HTTPGetAsyncAction

    //  HTTPRequestAction.h : 52
    
    public:
    static UHTTPRequestAction* HTTPGetAsyncAction(
        const UObject* WorldContext,
        FString URI
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient|HTTP

    Meta Specifiers:

    • DisplayName = HTTP GET
    • Keywords = NBPatreonAPIClient
    • WorldContext = WorldContext
    • BlueprintInternalUseOnly = true

    HTTP GET Request


    Arguments


    Returns

    • UHTTPRequestAction*
      
  • HTTPPostAsyncAction

    //  HTTPRequestAction.h : 63
    
    public:
    static UHTTPRequestAction* HTTPPostAsyncAction(
        const UObject* WorldContext,
        FString URI,
        FString Payload,
        TMap<FString, FString> Headers
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient|HTTP

    Meta Specifiers:

    • DisplayName = HTTP POST
    • Keywords = NBPatreonAPIClient
    • WorldContext = WorldContext
    • BlueprintInternalUseOnly = true

    HTTP POST Request


    Arguments

    • WorldContext

      const UObject* WorldContext
      
    • URI

      FString URI
      

      URI to request

    • Payload

      FString Payload
      

      POST data to include

    • Headers

      TMap<FString, FString> Headers
      

      (optional) Custom headers to include with request


    Returns

    • UHTTPRequestAction*
      
  • HTTPRequestAsyncAction

    //  HTTPRequestAction.h : 28
    
    public:
    static UHTTPRequestAction* HTTPRequestAsyncAction(
        const UObject* WorldContext,
        FString URI,
        FString Verb,
        FString Payload,
        TMap<FString, FString> Headers
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient|HTTP

    Meta Specifiers:

    • DisplayName = HTTP Request
    • Keywords = NBPatreonAPIClient
    • WorldContext = WorldContext
    • BlueprintInternalUseOnly = true

    Generic HTTP request


    Arguments

    • WorldContext

      const UObject* WorldContext
      
    • URI

      FString URI
      

      URI to request

    • Verb

      FString Verb
      

      HTTP method, e.g. GET or POST

    • Payload

      FString Payload
      

      (optional) additional payload to include with the request (depends on verb)

    • Headers

      TMap<FString, FString> Headers
      

      (optional) Custom headers to include with request


    Returns

    • UHTTPRequestAction*
      
  • HTTPRequestWithTokenAsyncAction

    //  HTTPRequestAction.h : 43
    
    public:
    static UHTTPRequestAction* HTTPRequestWithTokenAsyncAction(
        const UObject* WorldContext,
        FString URI,
        FString Verb,
        FString Payload,
        FString AccessToken,
        TMap<FString, FString> Headers
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient|HTTP

    Meta Specifiers:

    • DisplayName = HTTP Request (with bearer token)
    • Keywords = NBPatreonAPIClient
    • WorldContext = WorldContext
    • BlueprintInternalUseOnly = true

    HTTP Request with a bearer token.

    This will automatically set the Authorization header to Bearer <AccessToken>.


    Arguments

    • WorldContext

      const UObject* WorldContext
      
    • URI

      FString URI
      

      URI to request

    • Verb

      FString Verb
      

      HTTP method, e.g. GET or POST

    • Payload

      FString Payload
      

      (optional) additional payload to include with the request (depends on verb)

    • AccessToken

      FString AccessToken
      

      Access token to use

    • Headers

      TMap<FString, FString> Headers
      

      (optional) Custom headers to include with request


    Returns

    • UHTTPRequestAction*
      






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: UNBPatreonAPIClientBPLibrary

//  NBPatreonAPIClientBPLibrary.h : 9

class UNBPatreonAPIClientBPLibrary
    : public UBlueprintFunctionLibrary;

Reflection-enabled



Methods

  • HasBenefit

    //  NBPatreonAPIClientBPLibrary.h : 48
    
    public:
    static bool HasBenefit(
        const FPatreonUserInfo& UserInfo,
        const FString BenefitName
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintPure
    • BlueprintCallable
    • Category = NBPatreonAPIClient|User Info

    Meta Specifiers:

    • DisplayName = Has Benefit
    • Keywords = NBPatreonAPIClient

    Checks if the given User is entitled to a specific benefit/reward


    Arguments

    • UserInfo

      const FPatreonUserInfo& UserInfo
      

      User to check

    • BenefitName

      const FString BenefitName
      

    Returns

    • bool
      
  • HasBenefit2

    //  NBPatreonAPIClientBPLibrary.h : 56
    
    public:
    static bool HasBenefit2(
        const FPatreonUserInfoImgs& UserInfo,
        const FString BenefitName
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintPure
    • BlueprintCallable
    • Category = NBPatreonAPIClient|User Info

    Meta Specifiers:

    • DisplayName = Has Benefit
    • Keywords = NBPatreonAPIClient

    Checks if the given User is entitled to a specific benefit/reward


    Arguments

    • UserInfo

      const FPatreonUserInfoImgs& UserInfo
      

      User to check

    • BenefitName

      const FString BenefitName
      

    Returns

    • bool
      
  • HasTier

    //  NBPatreonAPIClientBPLibrary.h : 32
    
    public:
    static bool HasTier(
        const FPatreonUserInfo& UserInfo,
        const FString TierName
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintPure
    • BlueprintCallable
    • Category = NBPatreonAPIClient|User Info

    Meta Specifiers:

    • DisplayName = Has Tier
    • Keywords = NBPatreonAPIClient

    Checks if the given User is pledged to a specific tier.


    Arguments

    • UserInfo

      const FPatreonUserInfo& UserInfo
      

      User to check

    • TierName

      const FString TierName
      

      Name of tier, case-insensitive


    Returns

    • bool
      
  • HasTier2

    //  NBPatreonAPIClientBPLibrary.h : 40
    
    public:
    static bool HasTier2(
        const FPatreonUserInfoImgs& UserInfo,
        const FString TierName
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintPure
    • BlueprintCallable
    • Category = NBPatreonAPIClient|User Info

    Meta Specifiers:

    • DisplayName = Has Tier
    • Keywords = NBPatreonAPIClient

    Checks if the given User is pledged to a specific tier.


    Arguments

    • UserInfo

      const FPatreonUserInfoImgs& UserInfo
      

      User to check

    • TierName

      const FString TierName
      

      Name of tier, case-insensitive


    Returns

    • bool
      
  • HasTokenExpired

    //  NBPatreonAPIClientBPLibrary.h : 18
    
    public:
    static bool HasTokenExpired(
        const FAPITokenInfo& token
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintPure
    • BlueprintCallable
    • Category = NBPatreonAPIClient

    Meta Specifiers:

    • DisplayName = Has API Token Expired
    • Keywords = NBPatreonAPIClient

    Checks if a token's lifetime has expired.


    Arguments

    • token

      const FAPITokenInfo& token
      

    Returns

    • bool
      
  • IsTokenValid

    //  NBPatreonAPIClientBPLibrary.h : 24
    
    public:
    static bool IsTokenValid(
        const FAPITokenInfo& token
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintPure
    • BlueprintCallable
    • Category = NBPatreonAPIClient

    Meta Specifiers:

    • DisplayName = Is API Token Valid
    • Keywords = NBPatreonAPIClient

    Checks if the access token is present and not yet expired


    Arguments

    • token

      const FAPITokenInfo& token
      

    Returns

    • bool
      
  • OpenURL

    //  NBPatreonAPIClientBPLibrary.h : 82
    
    public:
    static void OpenURL(
        const FString URL
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient|HTTP

    Meta Specifiers:

    • DisplayName = Open URL
    • Keywords = NBPatreonAPIClient

    Opens a given URL in the user's default web browser


    Arguments

    • URL

      const FString URL
      
  • ParseTokenInfo

    //  NBPatreonAPIClientBPLibrary.h : 76
    
    public:
    static bool ParseTokenInfo(
        FString JsonStr,
        FAPITokenInfo& TokenInfo
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient

    Meta Specifiers:

    • DisplayName = Parse API Token Info
    • Keywords = NBPatreonAPIClient

    Parses a JSON string containing an access token, as provided by the Patreon API. This expects a JSON string of the form:

    {
    "access_token": <single use token>,
    "refresh_token" : <single use token>,
    "expires_in" : <token lifetime duration>,
    "scope" : <token scopes>,
    "token_type" : "Bearer"
    }
    

    Arguments

    • JsonStr

      FString JsonStr
      

      The JSON string to parse

    • TokenInfo

      FAPITokenInfo& TokenInfo
      

      The parsed TokenInfo object


    Returns

    • bool
      

      True if the JsonStr could be parsed, otherwise False. If this returns False, TokenInfo should not be used.






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: UPerformAuthenticationAsyncAction

//  PerformAuthenticationAsyncAction.h : 40

class NBPATREONAPICLIENT_API UPerformAuthenticationAsyncAction
    : public UCancellableAsyncAction;

Reflection-enabled


This action can be used to perform authentication with the Patreon API. The user's default web browser will be opened to allow them to sign in, a local HTTP server will be started to receive the authentication response from Patreon, and finally a request will be made to obtain an access token for the authenticated user.

The returned access token can be used to make additional requests to the Patreon API, e.g. to obtain information about the authenticated user and their pledges to determine if specific content should be unlocked for them.

IMPORTANT NOTE:

Because everything is being handled within the same process, using this action requires that the application have a copy of your client_id and client_secret, both of which will be included in HTTP requests sent to Patreon from the user's computer. This means that the user may be able to extract these values either from the packaged binaries or by analyzing their network traffic during the authentication process.

NEVER use your creator token here!


Properties

  • OnComplete

    public:
    FPerformAuthenticationAsyncActionEvent OnComplete;
    

    Reflection-enabled

    Specifiers:

    • BlueprintAssignable

    Event invoked when authentication is completed successfully
  • OnFail

    public:
    FPerformAuthenticationAsyncActionFailedEvent OnFail;
    

    Reflection-enabled

    Specifiers:

    • BlueprintAssignable

    Event invoked if authentication fails for any reason

Methods

  • Activate

    //  PerformAuthenticationAsyncAction.h : 115
    
    public:
    virtual void Activate() override;
    

    Starts the task

  • Cancel

    //  PerformAuthenticationAsyncAction.h : 120
    
    public:
    virtual void Cancel() override;
    

    Can be called to cancel the task and prevent callbacks from being called

  • MakeAuthURI

    //  PerformAuthenticationAsyncAction.h : 95
    
    public:
    static FString MakeAuthURI(
        const FString ClientID,
        const FString CallbackURI,
        FString id = TEXT("")
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient|HTTP

    Meta Specifiers:

    • DisplayName = Make Patreon Auth URI
    • Keywords = NBPatreonAPIClient

    Constructs a URI to the Patreon login/consent page, with default minimal scopes. This should be used to allow the user to authenticate with Patreon in a web browser.


    Arguments

    • ClientID

      const FString ClientID
      

      Patreon app Client ID

    • CallbackURI

      const FString CallbackURI
      

      URI to redirect the user to after successfully authenticating

    • id

      FString id = TEXT("")
      

      Optional session/state/id value which will be passed back to the CallbackURI after authentication. This can be used to match a specific request to a specific response if necessary.


    Returns

    • FString
      
  • PerformAuthenticationAsyncAction

    //  PerformAuthenticationAsyncAction.h : 54
    
    public:
    static UPerformAuthenticationAsyncAction* PerformAuthenticationAsyncAction(
        const UObject* WorldContext,
        const FString ClientID,
        const FString ClientSecret,
        const FString CallbackRoute = TEXT("/login"),
        const int32 CallbackPort = 8080
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient

    Meta Specifiers:

    • DisplayName = Perform Authentication
    • Keywords = NBPatreonAPIClient
    • WorldContext = WorldContext
    • BlueprintInternalUseOnly = true

    Performs OAuth login to Patreon using the user's default web browser


    Arguments

    • WorldContext

      const UObject* WorldContext
      
    • ClientID

      const FString ClientID
      

      Patreon App client_id

    • ClientSecret

      const FString ClientSecret
      

      Patreon App client_secret

    • CallbackRoute

      const FString CallbackRoute = TEXT("/login")
      

      URL fragment (after hostname and port) to expect the login callback to invoke

    • CallbackPort

      const int32 CallbackPort = 8080
      

      Port to listen on for the login callback


    Returns

    • UPerformAuthenticationAsyncAction*
      
  • PerformAuthenticationUMGAsyncAction

    //  PerformAuthenticationAsyncAction.h : 77
    
    public:
    static UPerformAuthenticationAsyncAction* PerformAuthenticationUMGAsyncAction(
        const UObject* WorldContext,
        UWebBrowser* BrowserWidget,
        const FString ClientID,
        const FString ClientSecret,
        const FString CallbackRoute = TEXT("/login"),
        const int32 CallbackPort = 8080
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient

    Meta Specifiers:

    • DisplayName = Perform Authentication (UMG Browser)
    • Keywords = NBPatreonAPIClient
    • WorldContext = WorldContext
    • BlueprintInternalUseOnly = true

    Performs OAuth login to Patreon using a UMG WebBrowser widget. (Requires the WebBrowser plugin to be enabled in your project)

    IMPORTANT NOTE:

    Due to limitations of the WebBrowser widget, users will need to sign in using their e-mail address. SSO methods like "Sign in with Google" will fail because these rely on opening a second browser window.


    Arguments

    • WorldContext

      const UObject* WorldContext
      
    • BrowserWidget

      UWebBrowser* BrowserWidget
      

      Widget to use to display the login page

    • ClientID

      const FString ClientID
      

      Patreon App client_id

    • ClientSecret

      const FString ClientSecret
      

      Patreon App client_secret

    • CallbackRoute

      const FString CallbackRoute = TEXT("/login")
      

      URL fragment (after hostname and port) to expect the login callback to invoke

    • CallbackPort

      const int32 CallbackPort = 8080
      

      Port to listen on for the login callback


    Returns

    • UPerformAuthenticationAsyncAction*
      






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Class: URefreshAPITokenAsyncAction

//  RefreshAPITokenAsyncAction.h : 17

class NBPATREONAPICLIENT_API URefreshAPITokenAsyncAction
    : public UCancellableAsyncAction;

Reflection-enabled


Refreshes an existing API access token


Properties

  • OnComplete

    public:
    FRefreshAPITokenAsyncActionEvent OnComplete;
    

    Reflection-enabled

    Specifiers:

    • BlueprintAssignable

    Event invoked when token refresh is completed successfully
  • OnFail

    public:
    FRefreshAPITokenAsyncActionFailedEvent OnFail;
    

    Reflection-enabled

    Specifiers:

    • BlueprintAssignable

    Event invoked if token refresh fails for any reason

Methods

  • Activate

    //  RefreshAPITokenAsyncAction.h : 44
    
    public:
    virtual void Activate() override;
    

    Starts the task

  • Cancel

    //  RefreshAPITokenAsyncAction.h : 49
    
    public:
    virtual void Cancel() override;
    

    Can be called to cancel the task and prevent callbacks from being called

  • RefreshAPITokenAsyncAction

    //  RefreshAPITokenAsyncAction.h : 26
    
    public:
    static URefreshAPITokenAsyncAction* RefreshAPITokenAsyncAction(
        const UObject* WorldContext,
        const FAPITokenInfo TokenInfo,
        const FString ClientID,
        const FString ClientSecret
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = NBPatreonAPIClient

    Meta Specifiers:

    • DisplayName = Refresh API Token
    • Keywords = NBPatreonAPIClient
    • WorldContext = WorldContext
    • BlueprintInternalUseOnly = true

    Refreshes an API access token


    Arguments


    Returns

    • URefreshAPITokenAsyncAction*
      






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Delegates






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Delegate: FGetPatreonUserInfoAsyncActionEvent

// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FGetPatreonUserInfoAsyncActionEvent,
    FPatreonUserInfo UserInfo
);

// Compatible function signature
void FGetPatreonUserInfoAsyncActionEvent(
    FPatreonUserInfo UserInfo
);


Parameters






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Delegate: FGetPatreonUserInfoAsyncActionFailedEvent

// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetPatreonUserInfoAsyncActionFailedEvent,);

// Compatible function signature
void FGetPatreonUserInfoAsyncActionFailedEvent();






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Delegate: FGetPatreonUserInfoImgAsyncActionEvent

// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FGetPatreonUserInfoImgAsyncActionEvent,
    FPatreonUserInfoImgs UserInfo
);

// Compatible function signature
void FGetPatreonUserInfoImgAsyncActionEvent(
    FPatreonUserInfoImgs UserInfo
);


Parameters

  • UserInfo

    FPatreonUserInfoImgs UserInfo
    






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Delegate: FGetPatreonUserInfoImgAsyncActionFailedEvent

// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetPatreonUserInfoImgAsyncActionFailedEvent,);

// Compatible function signature
void FGetPatreonUserInfoImgAsyncActionFailedEvent();






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Delegate: FHTTPRequestActionEvent

// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FHTTPRequestActionEvent,
    int32 ResponseCode,
    FString ResponseString
);

// Compatible function signature
void FHTTPRequestActionEvent(
    int32 ResponseCode,
    FString ResponseString
);


Parameters






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Delegate: FPerformAuthenticationAsyncActionEvent

// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPerformAuthenticationAsyncActionEvent,
    FAPITokenInfo TokenInfo
);

// Compatible function signature
void FPerformAuthenticationAsyncActionEvent(
    FAPITokenInfo TokenInfo
);


Parameters






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Delegate: FPerformAuthenticationAsyncActionFailedEvent

// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FPerformAuthenticationAsyncActionFailedEvent,);

// Compatible function signature
void FPerformAuthenticationAsyncActionFailedEvent();






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Delegate: FRefreshAPITokenAsyncActionEvent

// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FRefreshAPITokenAsyncActionEvent,
    FAPITokenInfo TokenInfo
);

// Compatible function signature
void FRefreshAPITokenAsyncActionEvent(
    FAPITokenInfo TokenInfo
);


Parameters






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com

Delegate: FRefreshAPITokenAsyncActionFailedEvent

// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FRefreshAPITokenAsyncActionFailedEvent,);

// Compatible function signature
void FRefreshAPITokenAsyncActionFailedEvent();






For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com