Usage & Examples
Before Getting Started
Before using this plugin, you should first Register an API Integration with SubscribeStar.
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 tier they are subscribed to. This allows you to easily do things like unlock specific in-game content for users subscribed to specific tiers, display information to the user about their subscription, etc.
This can be done with just a couple of BP nodes or a handful of lines of C++.
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 are linking to SubscribeStar, or perhaps you already have your own web service which connects to SubscribeStar for other reasons 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 SubscribeStar, how that gets tied into whatever other user data you may have, etc.
Running the examples
There is a demo map to show basic functionality in:
Engine/Plugins/NBSubscribeStarAPIClient Content/Examples/Maps/LoginDemo
However, if you run this map you will notice that the login buttons fail with the error:
Error: Ensure condition failed: !ClientID.IsEmpty() [...\NBPerformSSAuthenticationAction.cpp] [Line: 123]
Error: Cannot perform SubscribeStar authentication: No valid client ID was given!
This is because you have not yet provided your SubscribeStar client ID and secret.
The blueprints for the UI in the demo map are located in:
/Examples/UI/WBP_SubscribeStarLogin_WebBrowser
/Examples/UI/WBP_SubscribeStarLogin_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 integration you created in your SubscribeStar profile, 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.
Pages
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Adding a new API Integration
Before you can use the SubscribeStar API you need to add a new API Integration to your account
-
Navigate to https://www.subscribestar.com/profile/settings#oauth2_applications
-
Click the
Add Integration
button -
You should set the Integration Type to Indie Game, and set the Redirect URL and Scopes to match your intended usage
The value used in the
Redirect URL
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, for example to use something likehttp://localhost:9999/subscribestar
If you plan to use your own web service to proxy the authentication, then the
Redirect URL
should point to your web server.By default, this plugin will request data which requires the
subscriber.read
anduser.read
scopes. If you intend to perform your own custom queries against the SubscribeStar API, you may need to enable additional scopes. In general, you should always only enable the minimum number of required scopes, don't just enable them all.
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. For this
reason, you should always ensure you are using the smallest number of scopes when you register the integration on the
SubscribeStar side, you should never include any content_provider_profile
scopes.
Your Redirect URI
in your registered client should start with http://localhost
The process will work like this:
- You open the SubscribeStar login and consent page for your user (either using their default web browser or the UMG Web Browser widget).
- While they are signing in and granting your application access to their data, we start up an HTTP server within the game application
a. By default the server will listen for a request at
http://localhost:8080/login
, but you can customize this as you see fit b. Whatever you configure the server to use, you need to ensure that your integration's configuration on the SubscribeStar side has a matchingRedirect URL
, e.g. if you setCallback Route
to/login/subscribestar
andCallback Port
to9999
, you must update the settings in your SubscribeStar profile to include aRedirect URL
ofhttp://localhost:9999/login/subscribestar
.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 port80
should be larger than1024
- After consenting to sharing their data with your application, SubscribeStar 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. - Once we have an access token, we use this to request the user's account information, including any specific tiers they are subscribed to.
- You can then use this information as you want, e.g. checking if they are subscribed to a specific tier or paying over a certain amount for their subscription 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
C++
#include "Actions/NBSSGetUserInfoAction.h"
#include "Actions/NBSSAuthenticationAction.h"
#include "NBSubscribeStarAPITokenInfo.h"
#define CLIENT_ID TEXT("<Your Client ID>")
#define CLIENT_SECRET TEXT("<Your Client Secret>")
void MyClass::DoSubscribeStarLogin() {
// create an authentication action expecting a callback at http://localhost/login:8080
UNBSSAuthenticationAction* authAction = UNBSSAuthenticationAction::PerformAuthenticationAsyncAction(
this, // world context
CLIENT_ID,
CLIENT_SECRET
// scopes default to "subscriber.read+user.read"
// 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(FNBSubscribeStarAPITokenInfo TokenInfo) {
// now that we have a token, we can use it to fetch information about the user who just logged in
UNBSSGetUserInfoAction* getInfoAction = UNBSSGetUserInfoAction::UNBSSGetUserInfoAction(
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("SubscribeStar authentication failed: The user may have denied the request for their data")
);
}
void MyClass::OnGetUserInfoComplete(FNBSubscribeStarUserInfo UserInfo) {
// now that we have the user's information,
// we can check if they have subscribed to a tier with unlockable content
if (UserInfo.HasActiveSubscription && UserInfo.TierID == "SpecialTierID") {
UnlockSecretConent();
} else {
// suggest the user should pledge to the Special Tier ;)
}
}
void MyClass::OnGetUserInfoFail() {
UE_LOG(LogTemp, Error,
TEXT("Fetching user info from SubscribeStar 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 and Usage
Custom API Queries
GetUserInfo performs a simple query to fetch basic information about a user which should cover most use cases, e.g. just checking if a user has subscribed to your campaign or is subscribed to a specific tier.
If you need more information or just want to build and run your own queries against the SubscribeStar API, though, QuerySubscribeStarAPI provides an easy way to do this.
For example, to query for a subscriber's name using the query string {subscriber { name }}
:
The Result
will be the JSON string returned by the API. JSON parsing tools are not provided as part of this plugin
as there are a wide variety of existing solutions, free, paid, and built-in.
See the SubscribeStar API Documentation for more information about how to construct queries.
Authentication through your own web service
If you have your own web service to handle authentication with SubscribeStar's API, or you want to implement
one to keep your client_secret
outside of the application binary, then there is a helper to construct a
login URL for you which will redirect users to your web service after authenticating:
Open URL will open the URL in the user's default web browser.
Using tokens relayed from your own web service
If you already have an existing SubscribeStar integration and/or your own account system, you may wish to fetch access tokens for users from your service rather than going through the in-app authentication process described in SimpleSetup.
Given that you have some endpoint (e.g. /get-user-token
) which can return a valid token for a known user,
you can fetch, parse, and use it as follows:
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 SubscribeStarAPIClient
log category
Cancelling Async Actions
All async actions expose an Async Action
pin, which is a reference to the action while it runs in the background.
If you want to cancel an action, for example to enforce a timeout on a request or in response to a user navigating
away from part of the UI which is waiting for an action's result, you can use the Cancel
function:
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
Pages
- Perform Authentication
- Perform Authentication (UMG Browser)
- Refresh API Token
- Get User Info
- Query SubscribeStar API
- Parse API Token Info
- HTTP Request
- HTTP Request (with bearer token)
- HTTP GET
- HTTP POST
- Make SubscribeStar Auth URI
- Open URL
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
BP Function: PerformAuthentication
C++ Impl | UNBSSAuthenticationAction |
---|
This action can be used to perform authentication with the SubscribeStar API.
The user's default web browser will be opened a web page to allow them to sign in and give permission to your application to access some of their data.
A local HTTP server will be started to receive the authentication response from SubscribeStar, 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 SubscribeStar API, e.g. to obtain information about the authenticated user and their subscription 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
andclient_secret
, both of which will be included in HTTP requests sent to SubscribeStar 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.You should always configure the integration in your SubscribeStar profile to use the minimum number of scopes possible, and in general you should ensure no
content_provider_profile.*
scopes are enabled or else you might be exposing YOUR information to your users! If you have multiple API clients (e.g. a game using this plugin and a project website which connects to the SubscribeStar API) then you should use separateclient_id
s for them rather than sharing the sameclient_id
across all clients.
Inputs
-
Client ID
string
Your SubscribeStar App
client_id
. -
Client Secrent
string
Your SubscribeStar app
client_secret
. -
Scopes
string
List of scopes to request access to, separated by
+
. Should be a subset of the scopes you have configured your app for. -
Callback Route
string
[optional]
The URL to request the authentication callback at. Must match the redirect URI you set in your SubscribeStar app config. -
Callback Port
int
[optional]
The port to listen on for the authentication callback. Must match the redirect URI you set in your SubscribeStar 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 SubscribeStar API.
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
BP Function: PerformAuthentication (UMG Browser)
C++ Impl | UNBSSAuthenticationAction |
---|
Performs OAuth login to SubscribeStar 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 SubscribeStar API, e.g. to obtain information about the authenticated user and their subscription to determine if specific in-game content should be unlocked for them.
Inputs
-
Browser Widget
Web Browser
UMG WebBrowser widget you want the login page to be shown in.
-
Client ID
String
Your SubscribeStar app
client_id
. -
Client Secrent
String
Your SubscribeStar app
client_secret
. -
Scopes
string
List of scopes to request access to, separated by
+
. Should be a subset of the scopes you have configured your app for. -
Callback Route
String
[optional]
The URL to request the authentication callback at. Must match the redirect URI you set in your SubscribeStar app config. -
Callback Port
Integer
[optional]
The port to listen on for the authentication callback. Must match the redirect URI you set in your SubscribeStar 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 SubscribeStar API.
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
BP Function: Refresh API Token
C++ Impl | UNBSSRefreshAPITokenAction |
---|
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
-
Token Info
API Token Info
Token to refresh
-
Client ID
String
Your SubscribeStar app
client_id
. -
Client Secrent
String
Your SubscribeStar app
client_secret
.
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 SubscribeStar 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
C++ Impl | UNBSSGetUserInfoAction |
---|
Retrieves information about a SubscribeStar 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
-
Token Info
API Token Info
The user's API access token. Usually obtained via oauth.
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
NBSubscribeStarUserInfo
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: Query SubscribeStar API
C++ Impl | UNBQuerySubscribeStarAPIAction |
---|
This action can be used to submit custom queries to the SubscribeStar API.
You may wish to do this if you need to access specific information about a user or their subscription which is not fetched by the simple query used in GetUserInfo.
For more information about queries, see: https://www.subscribestar.com/api-explorer
NOTE: You may need to enable additional scopes for your API client to support your custom queries!
These additional scopes will need to be provided to PerformAuthentication during the initial authentication.
See here for more informaton about which scopes allow access to which data: https://www.subscribestar.com/api#integration
Inputs
-
Token Info
API Token Info
The user's API access token.
-
Query
_String
Query string
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.
-
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.
-
Result
String
The result of the query, usually a JSON string
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
BP Function: Parse API Token Info
C++ Impl | UNBSubscribeStarAPIClient |
---|
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>
}
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, otherwiseFalse
. If this value isFalse
,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
BP Function: HTTP Request
C++ Impl | UNBSSHTTPRequestAction |
---|
A generic HTTP request. Can be used to fetch web pages, content from REST APIs, 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
isGET
, then the payload will be appended to the URI as URL params. If theVerb
isPOST
, the payload will be included in the request body. -
Headers
Map of
Strings
toStrings
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)
C++ Impl | UNBSSHTTPRequestAction |
---|
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 SubscribeStar 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
isGET
, then the payload will be appended to the URI as URL params. If theVerb
isPOST
, 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
toStrings
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
C++ Impl | UNBSSHTTPRequestAction |
---|
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
C++ Impl | UNBSSHTTPRequestAction |
---|
Performs an HTTP POST request.
Inputs
-
URI
String
URI to request.
-
Payload
String
Optional. Additional POST data to include in the request.
-
Headers
Map of
Strings
toStrings
Optional. Additional HTTP headers to include in 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: Make SubscribeStar Auth URI
C++ Impl | UNBSSAuthenticationAction |
---|
Constructs a URI to the SubscribeStar login/consent page.
This is the page the user must visit in order to authenticate with SubscribeStar and generate a new access token.
Inputs
-
Client ID
String
You SubscribeStar app
Client ID
-
Callback URI
String
The URI the user's browser should redirect to after authenticating with SubscribeStar. This must match the
Redirect URI
set in your SubscribeStar integration settings. -
Scopes
String
Scopes to request access to. See: https://subscribestar.com/api#integration
Outputs
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
BP Function: Open URL
C++ Impl | UNBSubscribeStarAPIClient |
---|
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
Pages
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
BP Struct: SubscribeStar API Token Info
C++ Struct | FNBSubscribeStarAPITokenInfo |
---|
Stores an API access token and related information
Properties
-
Access Token
String
Access token used to make authenticated requests (e.g. retrieve user 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. -
TokenLifetime
TimeSpan
The time (in seconds) after
TokenReceived
that theAccess Token
is valid. -
TokenReceived
DateTime
The time (UTC)
Access Token
andRefresh Token
were received. This is used to check if theAccess Token
is still valid before attempting to use it.
Functions
-
Is API Token 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
-
Token
API Token Info
The token to check
Returns
True
if the token is valid and can be used, otherwise,False
. -
-
Has API Token Expired
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
-
Token
API Token Info
The token to check
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: SubscribeStar User Info
C++ Struct | FNBSubscribeStarUserInfo |
---|
Contains basic information about a user from the SubscribeStar API. This is meant as a convenience to cover the information most applications might need (e.g. to unlock specific content for users subscribed to a particular tier or to display information about their subscription to a user).
If the information contained here doesn't cover your needs, please feel free to contact me at nbpsup@gmail.com
Additionally, you can send a custom query to the SubscribeStar API to get any other data you need with the UNBQuerySubscribeStarAPIAction.
Properties
-
Name
String
Ther user's nickname.
-
Avatar URL
String
If set, contains a URL you can use to download the user's avatar image.
-
Has Active Subscription
Bool
Indicates whether this user is currently subscribed to your campaign or not.
If this is
false
, then either the user has never subscribed to your campaign before, or their subscription is currently inactive for some reason (e.g. payment processing problems).If this is
false
, fields related to subscription details should not be used. -
Tier ID
String
If you have separate subscription tiers and the user is subscribed to one, this contains the ID of the tier they are subscribed to.
-
Subscription Price
Int
The current subscription price (in cents) the user is paying.
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
C++ API Reference
Structs
Classes
FNBSubscribeStarAPIClientModule
UNBQuerySubscribeStarAPIAction
UNBSSAuthenticationAction
UNBSSGetUserInfoAction
UNBSSHTTPRequestAction
UNBSSRefreshAPITokenAction
UNBSubscribeStarAPIClient
Delegates
FGetSubscribeStarUserInfoActionEvent
FGetSubscribeStarUserInfoActionFailedEvent
FNBPerformSSAuthenticationActionEvent
FNBPerformSSAuthenticationActionFailedEvent
FNBQuerySubscribeStarAPIActionEvent
FNBSSHTTPRequestActionEvent
FNBSSRefreshAPITokenActionEvent
FNBSSRefreshAPITokenActionFailedEvent
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: FNBSubscribeStarAPITokenInfo
// NBSubscribeStarAPITokenInfo.h : 11
struct NBSUBSCRIBESTARAPICLIENT_API FNBSubscribeStarAPITokenInfo;
Reflection-enabled
Specifiers:
- BlueprintType
Stores an API access token and related information.
Properties
-
AccessToken
public: FString AccessToken;
Reflection-enabled
Specifiers:
- EditAnywhere
- BlueprintReadWrite
- Category = NBSubscribeStarAPIClient|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 = NBSubscribeStarAPIClient|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 = NBSubscribeStarAPIClient|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 = NBSubscribeStarAPIClient|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 = NBSubscribeStarAPIClient|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
-
FNBSubscribeStarAPITokenInfo
// NBSubscribeStarAPITokenInfo.h : 51 public: FNBSubscribeStarAPITokenInfo();
-
FNBSubscribeStarAPITokenInfo
// NBSubscribeStarAPITokenInfo.h : 53 public: FNBSubscribeStarAPITokenInfo( FString accessToken, FString refreshToken, int64 lifetime );
Methods
-
HasTokenExpired
// NBSubscribeStarAPITokenInfo.h : 63 public: bool HasTokenExpired() const;
-
IsValid
// NBSubscribeStarAPITokenInfo.h : 70 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
// NBSubscribeStarAPITokenInfo.h : 58 public: FTimespan RemainingLifetime() const;
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Struct: FNBSubscribeStarUserInfo
// NBSubscribeStarUserInfo.h : 20
struct NBSUBSCRIBESTARAPICLIENT_API FNBSubscribeStarUserInfo;
Reflection-enabled
Specifiers:
- BlueprintType
Contains basic information about a user from the SubscribeStar API. This is meant as a convenience to cover the information most applications might need (e.g. to unlock specific content for users subscribed to a particular tier or to display information about their subscription to a user).
If the information contained here doesn't cover your needs, please feel free to contact me at nbpsup@gmail.com
Additionally, you can send a custom query to the SubscribeStar API to get any other data you need with the UNBQuerySubscribeStarAPIAction.
Properties
-
AvatarURL
public: FString AvatarURL;
Reflection-enabled
Specifiers:
- EditAnywhere
- BlueprintReadWrite
- Category = NBSubscribeStarAPIClient|User
URL to download the user's avatar image -
HasActiveSubscription
public: bool HasActiveSubscription;
Reflection-enabled
Specifiers:
- EditAnywhere
- BlueprintReadWrite
- Category = NBSubscribeStarAPIClient|User
Indicates whether this user is currently subscribed to your campaign or not. If this is
false
, then either the user has never subscribed to your campaign before, or their subscription is currently inactive for some reason (e.g. payment processing problems).If this is
false
, fields related to subscription details should not be used. -
Name
public: FString Name;
Reflection-enabled
Specifiers:
- EditAnywhere
- BlueprintReadWrite
- Category = NBSubscribeStarAPIClient|User
User's SubscribeStar nickname (may not be their real name) -
SubscriptionPrice
public: int32 SubscriptionPrice;
Reflection-enabled
Specifiers:
- EditAnywhere
- BlueprintReadWrite
- Category = NBSubscribeStarAPIClient|User
Price of the user's current subscription, in cents. May be different from the user's **tier** price. -
TierID
public: FString TierID;
Reflection-enabled
Specifiers:
- EditAnywhere
- BlueprintReadWrite
- Category = NBSubscribeStarAPIClient|User
If the user is subscribed to a specific tier, contains the ID of the tier they are subscribed to.
Constructors
-
FNBSubscribeStarUserInfo
// NBSubscribeStarUserInfo.h : 25 public: FNBSubscribeStarUserInfo();
-
FNBSubscribeStarUserInfo
// NBSubscribeStarUserInfo.h : 33 public: FNBSubscribeStarUserInfo( const FString& json );
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Classes
FNBSubscribeStarAPIClientModule
UNBQuerySubscribeStarAPIAction
UNBSSAuthenticationAction
UNBSSGetUserInfoAction
UNBSSHTTPRequestAction
UNBSSRefreshAPITokenAction
UNBSubscribeStarAPIClient
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Class: FNBSubscribeStarAPIClientModule
// NBSubscribeStarAPIClientModule.h : 8
class FNBSubscribeStarAPIClientModule
: public IModuleInterface;
Methods
-
ShutdownModule
// NBSubscribeStarAPIClientModule.h : 14 public: virtual void ShutdownModule() override;
-
StartupModule
// NBSubscribeStarAPIClientModule.h : 13 public: virtual void StartupModule() override;
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Class: UNBQuerySubscribeStarAPIAction
// NBQuerySubscribeStarAPIAction.h : 35
class NBSUBSCRIBESTARAPICLIENT_API UNBQuerySubscribeStarAPIAction
: public UCancellableAsyncAction;
Reflection-enabled
This action can be used to submit custom queries to the SubscribeStar API.
You may wish to do this if you need to access specific information about a user or their subscription
which is not fetched by the simple query used in UNBSSGetUserInfoAction
For more information about queries, see: https://www.subscribestar.com/api-explorer
NOTE: You may need to enable additional scopes for your API client to support your custom queries!
These additional scopes will need to be provided to
UNBSSAuthenticationAction
during the initial authentication.See here for more informaton about which scopes allow access to which data: https://www.subscribestar.com/api#integration
Properties
-
OnComplete
public: FNBQuerySubscribeStarAPIActionEvent OnComplete;
Reflection-enabled
Specifiers:
- BlueprintAssignable
Event fired when the task completes successfully -
OnFail
public: FNBQuerySubscribeStarAPIActionEvent OnFail;
Reflection-enabled
Specifiers:
- BlueprintAssignable
Event fired if the task fails for any reason
Methods
-
Activate
// NBQuerySubscribeStarAPIAction.h : 67 public: virtual void Activate() override;
Starts the task
-
Cancel
// NBQuerySubscribeStarAPIAction.h : 72 public: virtual void Cancel() override;
Can be called to cancel the task and prevent callbacks from being called
-
QueryAction
// NBQuerySubscribeStarAPIAction.h : 49 public: static UNBQuerySubscribeStarAPIAction* QueryAction( const UObject* WorldContext, FNBSubscribeStarAPITokenInfo TokenInfo, const FString Query );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient
Meta Specifiers:
- DisplayName = Query SubscribeStar API
- Keywords = SubscribeStar Query
- WorldContext = WorldContext
- BlueprintInternalUseOnly = true
Performs a query on the SubscribeStar API
Arguments
-
WorldContext
const UObject* WorldContext
-
TokenInfo
FNBSubscribeStarAPITokenInfo TokenInfo
Must contain a valid unexpired access token
-
Query
const FString Query
Query string
Returns
-
UNBQuerySubscribeStarAPIAction*
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Class: UNBSSAuthenticationAction
// NBSSAuthenticationAction.h : 53
class NBSUBSCRIBESTARAPICLIENT_API UNBSSAuthenticationAction
: public UCancellableAsyncAction;
Reflection-enabled
This action can be used to perform authentication with the SubscribeStar API.
The user will be directed to a web page to allow them to sign in and give permission to your application to access some of their data.
A local HTTP server will be started to receive the authentication response from SubscribeStar, 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 SubscribeStar API, e.g. to obtain information about the authenticated user and their subscription 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
andclient_secret
, both of which will be included in HTTP requests sent to SubscribeStar 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.
You should always configure the integration in your SubscribeStar
profile to use the minimum number of scopes possible, and in
general you should ensure no content_provider_profile.*
scopes
are enabled or else you might be exposing YOUR information to
your users! If you have multiple API clients (e.g. a game using
this plugin and a project website which connects to the SubscribeStar
API) then you should use separate client_id
s for them rather than
sharing the same client_id
across all clients.
Properties
-
OnComplete
public: FNBPerformSSAuthenticationActionEvent OnComplete;
Reflection-enabled
Specifiers:
- BlueprintAssignable
Event invoked when authentication is completed successfully -
OnFail
public: FNBPerformSSAuthenticationActionFailedEvent OnFail;
Reflection-enabled
Specifiers:
- BlueprintAssignable
Event invoked if authentication fails for any reason
Methods
-
Activate
// NBSSAuthenticationAction.h : 124 public: virtual void Activate() override;
Starts the task
-
Cancel
// NBSSAuthenticationAction.h : 129 public: virtual void Cancel() override;
Can be called to cancel the task and prevent callbacks from being called
-
MakeAuthURI
// NBSSAuthenticationAction.h : 104 public: static FString MakeAuthURI( const FString ClientID, const FString CallbackURI, FString Scopes );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient|HTTP
Meta Specifiers:
- DisplayName = Make SubscribeStar Auth URI
- Keywords = NBSubscribeStarAPIClient
Constructs a URI to the SubscribeStar login/consent page. This should be used to allow the user to authenticate with SubscribeStar in a web browser.
Arguments
-
ClientID
const FString ClientID
SubscribeStar app Client ID
-
CallbackURI
const FString CallbackURI
URI to redirect the user to after successfully authenticating
-
Scopes
FString Scopes
Scopes to request access to. See: https://subscribestar.com/api#integration
Returns
-
FString
Auth URI, ready to be passed to a web browser
-
PerformAuthenticationAsyncAction
// NBSSAuthenticationAction.h : 68 public: static UNBSSAuthenticationAction* PerformAuthenticationAsyncAction( const UObject* WorldContext, const FString ClientID, const FString ClientSecret, const FString Scopes = TEXT("subscriber.read+user.read"), const FString CallbackRoute = TEXT("/login"), const int32 CallbackPort = 8080 );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient
Meta Specifiers:
- DisplayName = Perform Authentication
- Keywords = NBSubscribeStarAPIClient
- WorldContext = WorldContext
- BlueprintInternalUseOnly = true
Performs OAuth login to SubscribeStar using the user's default web browser
Arguments
-
WorldContext
const UObject* WorldContext
-
ClientID
const FString ClientID
SubscribeStar App client_id
-
ClientSecret
const FString ClientSecret
SubscribeStar App client_secret
-
Scopes
const FString Scopes = TEXT("subscriber.read+user.read")
List of scopes to request access to, separated by
+
. Should be a subset of the scopes you have configured your app for. -
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
-
UNBSSAuthenticationAction*
-
PerformAuthenticationUMGAsyncAction
// NBSSAuthenticationAction.h : 88 public: static UNBSSAuthenticationAction* PerformAuthenticationUMGAsyncAction( const UObject* WorldContext, UWebBrowser* BrowserWidget, const FString ClientID, const FString ClientSecret, const FString Scopes = TEXT("subscriber.read+user.read"), const FString CallbackRoute = TEXT("/login"), const int32 CallbackPort = 8080 );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient
Meta Specifiers:
- DisplayName = Perform Authentication (UMG Browser)
- Keywords = NBSubscribeStarAPIClient
- WorldContext = WorldContext
- BlueprintInternalUseOnly = true
Performs OAuth login to SubscribeStar using a UMG WebBrowser widget. (Requires the
WebBrowser
plugin to be enabled in your project)
Arguments
-
WorldContext
const UObject* WorldContext
-
BrowserWidget
UWebBrowser* BrowserWidget
Widget to use to display the login page
-
ClientID
const FString ClientID
SubscribeStar App client_id
-
ClientSecret
const FString ClientSecret
SubscribeStar App client_secret
-
Scopes
const FString Scopes = TEXT("subscriber.read+user.read")
List of scopes to request access to, separated by
+
. Should be a subset of the scopes you have configured your app for. -
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
-
UNBSSAuthenticationAction*
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Class: UNBSSGetUserInfoAction
// NBSSGetUserInfoAction.h : 26
class NBSUBSCRIBESTARAPICLIENT_API UNBSSGetUserInfoAction
: public UCancellableAsyncAction;
Reflection-enabled
Retrieves information about a SubscribeStar 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.
If you need additional information about a user not provided by this action, you can use
UNBQuerySubscribeStarAPIAction
to submit a custom query to the API.
Properties
-
OnComplete
public: FGetSubscribeStarUserInfoActionEvent OnComplete;
Reflection-enabled
Specifiers:
- BlueprintAssignable
Event fired when the task completes successfully -
OnFail
public: FGetSubscribeStarUserInfoActionFailedEvent OnFail;
Reflection-enabled
Specifiers:
- BlueprintAssignable
Event fired if the task fails for any reason
Methods
-
Activate
// NBSSGetUserInfoAction.h : 58 public: virtual void Activate() override;
Starts the task
-
Cancel
// NBSSGetUserInfoAction.h : 63 public: virtual void Cancel() override;
Can be called to cancel the task and prevent callbacks from being called
-
GetSubscribeStarUserInfoAsyncAction
// NBSSGetUserInfoAction.h : 40 public: static UNBSSGetUserInfoAction* GetSubscribeStarUserInfoAsyncAction( const UObject* WorldContext, FNBSubscribeStarAPITokenInfo TokenInfo );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient
Meta Specifiers:
- DisplayName = Get User Info
- Keywords = SubscribeStar
- WorldContext = WorldContext
- BlueprintInternalUseOnly = true
Retrieves basic information about the user and their subscription (if they have one)
Will fail if the access token is empty, invalid, or expired.
Arguments
-
WorldContext
const UObject* WorldContext
-
TokenInfo
FNBSubscribeStarAPITokenInfo TokenInfo
Token information for the user
Returns
-
UNBSSGetUserInfoAction*
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Class: UNBSSHTTPRequestAction
// NBSSHTTPRequestAction.h : 15
class NBSUBSCRIBESTARAPICLIENT_API UNBSSHTTPRequestAction
: public UCancellableAsyncAction;
Reflection-enabled
Helper to make common HTTP requests a little easier and expose them to blueprints.
Properties
-
OnComplete
public: FNBSSHTTPRequestActionEvent OnComplete;
Reflection-enabled
Specifiers:
- BlueprintAssignable
Event fired when the request completes successfully -
OnFail
public: FNBSSHTTPRequestActionEvent OnFail;
Reflection-enabled
Specifiers:
- BlueprintAssignable
Event fired if the request fails for any reason
Methods
-
Activate
// NBSSHTTPRequestAction.h : 84 public: virtual void Activate() override;
Starts the task
-
Cancel
// NBSSHTTPRequestAction.h : 89 public: virtual void Cancel() override;
Can be called to cancel the task and prevent callbacks from being invoked
-
HTTPGetAction
// NBSSHTTPRequestAction.h : 55 public: static UNBSSHTTPRequestAction* HTTPGetAction( const UObject* WorldContext, FString URI );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient|HTTP
Meta Specifiers:
- DisplayName = HTTP GET
- Keywords = SubscribeStar HTTP
- WorldContext = WorldContext
- BlueprintInternalUseOnly = true
HTTP GET Request
Arguments
-
WorldContext
const UObject* WorldContext
-
URI
FString URI
URI to request
Returns
-
UNBSSHTTPRequestAction*
-
HTTPPostAction
// NBSSHTTPRequestAction.h : 66 public: static UNBSSHTTPRequestAction* HTTPPostAction( const UObject* WorldContext, FString URI, FString Payload, TMap<FString, FString> Headers );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient|HTTP
Meta Specifiers:
- DisplayName = HTTP POST
- Keywords = SubscribeStar HTTP
- 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
-
UNBSSHTTPRequestAction*
-
HTTPRequestAction
// NBSSHTTPRequestAction.h : 31 public: static UNBSSHTTPRequestAction* HTTPRequestAction( const UObject* WorldContext, FString URI, FString Verb, FString Payload, TMap<FString, FString> Headers );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient|HTTP
Meta Specifiers:
- DisplayName = HTTP Request
- Keywords = SubscribeStar HTTP
- 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
orPOST
-
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
-
UNBSSHTTPRequestAction*
-
HTTPRequestWithTokenAction
// NBSSHTTPRequestAction.h : 46 public: static UNBSSHTTPRequestAction* HTTPRequestWithTokenAction( const UObject* WorldContext, FString URI, FString Verb, FString Payload, FString AccessToken, TMap<FString, FString> Headers );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient|HTTP
Meta Specifiers:
- DisplayName = HTTP Request (with bearer token)
- Keywords = SubscribeStar HTTP
- WorldContext = WorldContext
- BlueprintInternalUseOnly = true
HTTP Request with a bearer token.
This will automatically set the
Authorization
header toBearer <AccessToken>
.
Arguments
-
WorldContext
const UObject* WorldContext
-
URI
FString URI
URI to request
-
Verb
FString Verb
HTTP method, e.g.
GET
orPOST
-
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
-
UNBSSHTTPRequestAction*
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Class: UNBSSRefreshAPITokenAction
// NBSSRefreshAPITokenAction.h : 26
class NBSUBSCRIBESTARAPICLIENT_API UNBSSRefreshAPITokenAction
: public UCancellableAsyncAction;
Reflection-enabled
Refreshes an existing API access token.
Properties
-
OnComplete
public: FNBSSRefreshAPITokenActionEvent OnComplete;
Reflection-enabled
Specifiers:
- BlueprintAssignable
Event invoked when token refresh is completed successfully -
OnFail
public: FNBSSRefreshAPITokenActionFailedEvent OnFail;
Reflection-enabled
Specifiers:
- BlueprintAssignable
Event invoked if token refresh fails for any reason
Methods
-
Activate
// NBSSRefreshAPITokenAction.h : 53 public: virtual void Activate() override;
Starts the task
-
Cancel
// NBSSRefreshAPITokenAction.h : 58 public: virtual void Cancel() override;
Can be called to cancel the task and prevent callbacks from being called
-
RefreshAPITokenAsyncAction
// NBSSRefreshAPITokenAction.h : 35 public: static UNBSSRefreshAPITokenAction* RefreshAPITokenAsyncAction( const UObject* WorldContext, const FNBSubscribeStarAPITokenInfo TokenInfo, const FString ClientID, const FString ClientSecret );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient
Meta Specifiers:
- DisplayName = Refresh API Token
- Keywords = SubscribeStar
- WorldContext = WorldContext
- BlueprintInternalUseOnly = true
Refreshes an API access token
Arguments
-
WorldContext
const UObject* WorldContext
-
TokenInfo
const FNBSubscribeStarAPITokenInfo TokenInfo
-
ClientID
const FString ClientID
-
ClientSecret
const FString ClientSecret
Returns
-
UNBSSRefreshAPITokenAction*
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Class: UNBSubscribeStarAPIClient
// NBSubscribeStarAPIClient.h : 12
class NBSUBSCRIBESTARAPICLIENT_API UNBSubscribeStarAPIClient
: public UBlueprintFunctionLibrary;
Reflection-enabled
Exposes several useful functions to Blueprints
Methods
-
HasTokenExpired
// NBSubscribeStarAPIClient.h : 21 public: static bool HasTokenExpired( const FNBSubscribeStarAPITokenInfo& token );
Reflection-enabled
Specifiers:
- BlueprintPure
- BlueprintCallable
- Category = NBSubscribeStarAPIClient
Meta Specifiers:
- DisplayName = Has API Token Expired
- Keywords = SubscribeStar
Checks if a token's lifetime has expired.
Arguments
-
token
const FNBSubscribeStarAPITokenInfo& token
Returns
-
bool
-
IsTokenValid
// NBSubscribeStarAPIClient.h : 27 public: static bool IsTokenValid( const FNBSubscribeStarAPITokenInfo& token );
Reflection-enabled
Specifiers:
- BlueprintPure
- BlueprintCallable
- Category = NBSubscribeStarAPIClient
Meta Specifiers:
- DisplayName = Is API Token Valid
- Keywords = SubscribeStar
Checks if the access token is present and not yet expired
Arguments
-
token
const FNBSubscribeStarAPITokenInfo& token
Returns
-
bool
-
OpenURL
// NBSubscribeStarAPIClient.h : 52 public: static void OpenURL( const FString URL );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient|HTTP
Meta Specifiers:
- DisplayName = Open URL
- Keywords = SubscribeStar HTTP URL
Opens a given URL in the user's default web browser
Arguments
-
URL
const FString URL
-
ParseTokenInfo
// NBSubscribeStarAPIClient.h : 46 public: static bool ParseTokenInfo( FString JsonStr, FNBSubscribeStarAPITokenInfo& TokenInfo );
Reflection-enabled
Specifiers:
- BlueprintCallable
- Category = NBSubscribeStarAPIClient
Meta Specifiers:
- DisplayName = Parse API Token Info
- Keywords = SubscribeStar
Parses a JSON string containing an access token, as provided by the SubscribeStar 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> }
Arguments
-
JsonStr
FString JsonStr
The JSON string to parse
-
TokenInfo
FNBSubscribeStarAPITokenInfo& 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
Delegates
FGetSubscribeStarUserInfoActionEvent
FGetSubscribeStarUserInfoActionFailedEvent
FNBPerformSSAuthenticationActionEvent
FNBPerformSSAuthenticationActionFailedEvent
FNBQuerySubscribeStarAPIActionEvent
FNBSSHTTPRequestActionEvent
FNBSSRefreshAPITokenActionEvent
FNBSSRefreshAPITokenActionFailedEvent
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Delegate: FGetSubscribeStarUserInfoActionEvent
// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FGetSubscribeStarUserInfoActionEvent,
FNBSubscribeStarUserInfo UserInfo
);
// Compatible function signature
void FGetSubscribeStarUserInfoActionEvent(
FNBSubscribeStarUserInfo UserInfo
);
Parameters
-
UserInfo
FNBSubscribeStarUserInfo UserInfo
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Delegate: FGetSubscribeStarUserInfoActionFailedEvent
// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetSubscribeStarUserInfoActionFailedEvent);
// Compatible function signature
void FGetSubscribeStarUserInfoActionFailedEvent();
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Delegate: FNBPerformSSAuthenticationActionEvent
// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FNBPerformSSAuthenticationActionEvent,
FNBSubscribeStarAPITokenInfo TokenInfo
);
// Compatible function signature
void FNBPerformSSAuthenticationActionEvent(
FNBSubscribeStarAPITokenInfo TokenInfo
);
Parameters
-
TokenInfo
FNBSubscribeStarAPITokenInfo TokenInfo
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Delegate: FNBPerformSSAuthenticationActionFailedEvent
// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FNBPerformSSAuthenticationActionFailedEvent);
// Compatible function signature
void FNBPerformSSAuthenticationActionFailedEvent();
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Delegate: FNBQuerySubscribeStarAPIActionEvent
// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FNBQuerySubscribeStarAPIActionEvent,
FString Result
);
// Compatible function signature
void FNBQuerySubscribeStarAPIActionEvent(
FString Result
);
Event fired when a UNBQuerySubscribeStarAPIAction
action completes or fails.
Parameters
-
Result
FString Result
The result of a query from a
UNBQuerySubscribeStarAPIAction
, usually a JSON string
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Delegate: FNBSSHTTPRequestActionEvent
// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FNBSSHTTPRequestActionEvent,
int32 ResponseCode,
FString ResponseString
);
// Compatible function signature
void FNBSSHTTPRequestActionEvent(
int32 ResponseCode,
FString ResponseString
);
Parameters
-
ResponseCode
int32 ResponseCode
-
ResponseString
FString ResponseString
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Delegate: FNBSSRefreshAPITokenActionEvent
// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FNBSSRefreshAPITokenActionEvent,
FNBSubscribeStarAPITokenInfo TokenInfo
);
// Compatible function signature
void FNBSSRefreshAPITokenActionEvent(
FNBSubscribeStarAPITokenInfo TokenInfo
);
Event fired when the UNBSSRefreshAPITokenAction
action is successful
Parameters
-
TokenInfo
FNBSubscribeStarAPITokenInfo TokenInfo
The new access token and associated details
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com
Delegate: FNBSSRefreshAPITokenActionFailedEvent
// Delegate type
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FNBSSRefreshAPITokenActionFailedEvent);
// Compatible function signature
void FNBSSRefreshAPITokenActionFailedEvent();
Event fired when UNBSSRefreshAPITokenAction
action fails
For any questions, help, suggestions or feature requests, please feel free to contact me at nbpsup@gmail.com