Class: UPerformAuthenticationAsyncAction

//  PerformAuthenticationAsyncAction.h : 42

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 (if you use one), 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 : 123
    
    public:
    virtual void Activate() override;
    

    Starts the task

  • Cancel

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

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

  • MakeAuthURI

    //  PerformAuthenticationAsyncAction.h : 103
    
    public:
    static FString MakeAuthURI(
        const FString ClientID,
        const FString CallbackURI,
        const FString CustomScopes = TEXT(""),
        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

    • CustomScopes

      const FString CustomScopes = TEXT("")
      

      By default only authorization for the 'identity' scope will be requested. If you need additional scopes, specify them here. See here for more information

    • 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 : 57
    
    public:
    static UPerformAuthenticationAsyncAction* PerformAuthenticationAsyncAction(
        const UObject* WorldContext,
        const FString ClientID,
        const FString ClientSecret,
        const FString CallbackRoute = TEXT("/login"),
        const int32 CallbackPort = 8080,
        const FString ScopeOverrides = TEXT("")
    );
    

    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 - OPTIONAL - Leave empty if not using a 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

    • ScopeOverrides

      const FString ScopeOverrides = TEXT("")
      

      By default only the 'identity' scope will be requested. If you need more specify them here.


    Returns

    • UPerformAuthenticationAsyncAction*
      
  • PerformAuthenticationUMGAsyncAction

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

    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 - OPTIONAL - Leave empty if not using a 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

    • ScopeOverrides

      const FString ScopeOverrides = TEXT("")
      

      By default only the 'identity' scope will be requested. If you need more specify them here.


    Returns

    • UPerformAuthenticationAsyncAction*
      






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