Roku Auth SDK

The Roku Auth SDK is an authentication library written in Brightscript. It designed to streamline the login process with Auth0, providing developers with efficient tools to retrieve login details and authenticate users swiftly. Beyond its authentication capabilities, the Auth SDK encompasses Subscription Video-On-Demand (SVOD) and Transactional Video-On-Demand (TVOD) functionalities. This comprehensive feature set empowers developers to seamlessly integrate subscription and transactional video services.

Features

The dotstudioPRO Roku Auth SDK boasts robust support for seamless login processes through Auth0 integration. Leveraging the Core SDK, it efficiently communicates with the API to retrieve SVOD (Subscription Video-On-Demand) or TVOD (Transactional Video-On-Demand) plans, displaying subscription options for users. Users can easily subscribe or make individual purchases through designated Roku store. Following the user's transactional actions on the store, the SDK triggers an API call to confirm the subscription status.

Key Features:

  • Comprehensive Functionality Support: The SDK have comprehensive support for login, logout, SVOD(Subscription Video On Demand), and TVOD(Transactional Video On Demand) purchase functionalities.
  • Internal User Detail Storage: The Auth SDK also internally stores user details upon successful login.
  • Efficient Callback Handling: The Auth SDK efficiently manages the necessary callbacks for key events such as login, logout, SVOD(Subscription Video On Demand), and TVOD(Transactional Video On Demand).

Requirements

Please review the following details for accurate information on the minimum OS requirements.

Platform Minimum Version Installation Status
Roku 11.0+ Fully Tested


Installation

Utilize the following commands to seamlessly install the Roku Auth SDK into your React Native project:

git clone https://github.com/dotstudiopro/auth-roku.git

Copy the auth-roku/dotstudioPRO-auth folder into your channel so that the path to the folder is pkg:/components/dotstudioPRO-auth

OR

Use Xcopy command for copy auth-roku folder and put in Apps pkg:/components folder

Xcopy [source File Path] [destination File Path] /E /H /C /I.

How to Use

Auth

To add Auth Component in your Roku Scene xml and brs file.
Roku-Auth-Code.png


Function init()
  m.authcontroller = m.top.findNode("authcontroller")
  m.authcontroller.setFocus(true)
  m.authcontrollerConfig = {
    "skippable": false,
    "authenticationType": "login",
    "auth0Config": {
        ClientId : ,
        CustomerTokenKey : ,
        UserMetadata: ,
        DomainName: 
        scope : ,
        grantType : ,
     },
     "theme":{
      "refreshbuttonImage" : "pkg:/images/refresh_code.png",
      "screenBackgrounColor" : "#ffffff",
      "activateBackgroundColor" : "#D3D3D3",
      "maintitletextColor":"#1E1E1E",
      "secondrytextColor" : "#696966",
      "activationCodetextColor" : "#AA3D47",
      "maintitleFont":{
        font : "",'use any app font like this "pkg:/fonts/abc.ttf"
        size : "66"
      },
      "secondrytextFont":{
        font : "",
        size : "32"
      },
      "activationCodeFont":{
        font : "",
        size : "45"
      },
      "activationCodeHeaderFont":{
        font : "",
        size : "38"
      },

    },
  }
  m.authcontroller.callFunc("AuthController",m.authcontrollerConfig)
  m.authcontroller.observeField("onAuthenticationSuccess", "onAuthenticationSuccess")
  m.authcontroller.observeField("onAuthenticationFail", "onAuthenticationFail")
end Function

SVOD (Subscription Video On Demand)

To add SVOD Component in your Roku Scene xml and brs file.


Function onSelectSubscriptionButton()
    m.svodplanscreen = CreateChildNode("SVODPlansScreen")
    m.svodplanscreen.observeField("onSelectPlan", "onSelectPlan")
    m.svodplanscreen.observeField("onRestoreSubscription", "onRestoreSubscription")
    m.svodplanscreen.observeField("onSelectSkipForNow", "onSelectSkipForNow")
    m.svodplanscreen.observeField("onTryWithDiffAcc", "onTryWithDiffAcc")
End Function

Function onSelectPlan(message as object) as void
    plan= message.getRoSGNode()
    m.svodPlandetail = CreateChildNode("SVODPlanDetailScreen")
    m.svodPlandetail.plandata = plan.onSelectPlan
    m.svodPlandetail.observeField("screenresponse", "onScreenresponse")
    m.svodPlandetail.observeField("onSubscriptionSuccess", "onSubscriptionSuccess")
    m.svodPlandetail.observeField("onSubscriptionFail", "onSubscriptionFail")
End Function

TVOD (Transactional Video On Demand)

To add TVOD Component in your Roku Scene xml and brs file.


Function onSelectTvodButton()
    channelContent = CreateObject("roSGNode", "ContentNode")
    channelContent.addfield("dspro_id","string",false)
    channelContent.dspro_id = 

    m.tvodplanscreen = CreateChildNode("TVODPlansScreen")
    m.tvodplanscreen.channelObj = channelContent
    m.tvodplanscreen.UnobserveField("onSelectPlan")
    m.tvodplanscreen.observeField("onSelectPlan", "onSelectPlan")
    m.tvodplanscreen.observeField("purchasestatus", "onPurchaseStatus")
    m.tvodplanscreen.observeField("onSelectSkipForNow", "onSelectSkipForNow")
    m.tvodplanscreen.observeField("onTryWithDiffAcc", "onTryWithDiffAcc")
End Function

Function onSelectPlan()
    plan= message.getRoSGNode()
    planSelected = message.getData()
    if planSelected.product_type = "svod" and m.authcontrollerConfig.authenticationType = "tvod" then
        ' CloseScreen(m.tvodplanscreen)
        m.svodPlandetail = CreateChildNode("SVODPlanDetailScreen")
        m.svodPlandetail.plandata = planSelected
        m.svodPlandetail.observeField("screenresponse", "onScreenresponse")
        m.svodPlandetail.observeField("onSubscriptionSuccess", "onSubscriptionSuccess")
        m.svodPlandetail.observeField("onSubscriptionFail", "onSubscriptionFail")
        ShowScreen(m.svodPlandetail)
    else
        m.tvodPlandetail = CreateChildNode("TVODPlanDetailScreen")
        m.tvodPlandetail.plandata = planSelected
        m.tvodPlandetail.productid = planSelected._id
        m.tvodPlandetail.observeField("screenresponse", "onScreenresponse")
        m.tvodPlandetail.observeField("onSubscriptionSuccess", "onSubscriptionSuccess")
        m.tvodPlandetail.observeField("onSubscriptionFail", "onSubscriptionFail")
        ShowScreen(m.tvodPlandetail)
    end if 
End Function


Properties

Key Type Description
authenticationType Id Login, SVOD and TVOD
ClientId Id Client Id of auth0
CustomerTokenKey URL Custom token key URL
UserMetadata URL Custom token key URL
DomainName URL Domain name URL
scope string scope
grantType string Grant type
channel_id TVOD dpro_id (channel id) for channel you want to do changes

Updated