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