Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@openpass/openpass-roku-sdk
Advanced tools
The OpenPass Roku SDK makes it easier to integrate OpenPass directly on your Roku channels.
The preferred installation method is via ropm
ropm install @openpass/openpass-roku-sdk
Copy openpass_openpassrokusdk
files inside your source folder
In order to use this SDK you will need the following requirements
Install Node.JS from here
Install the Roku Package Manager node module globally
npm i ropm -g
Install BrighterScript module globally
npm install brighterscript -g
At project root level run
ropm install
Enable Developer Mode on you Roku device, you can see more here
In order to use npm scripts
to run the project locally, you will need to add the following ENV VARS to your system:
ROKU_HOST
: This is the IP Address of your Roku device.ROKU_DEV_PASSWORD
: This is the password you set for your Roku device when Developer Mode
was enabled.To add the variables to your system for Mac or Linux:
If using zsh
as your shell
echo 'export ROKU_DEV_PASSWORD=<YOUR_DEVICE_PASSWORD>' >> ~/.zshrc
echo 'export ROKU_HOST=<YOUR_DEVICE_HOST_IP>' >> ~/.zshrc
If using bash
as your shell
echo 'export ROKU_DEV_PASSWORD=<YOUR_DEVICE_PASSWORD>' >> ~/.bash_profile
echo 'export ROKU_HOST=<YOUR_DEVICE_HOST_IP>' >> ~/.bash_profile
To add the variables to your system if using Windows
```bash
setx ROKU_DEV_PASSWORD "<YOUR_DEVICE_PASSWORD>"
setx ROKU_HOST "<ROKU_HOST>"
```
ropm install @openpass/openpass-roku-sdk
create a task for Authorize Device flow: tasks/AuthorizeDeviceTask.brs
sub Init()
m.top.functionName = "AuthorizeDevice"
end sub
sub AuthorizeDevice()
' Your client Id
clientId = "CLIENT_ID"
' Attach Device response from SDK, returning an object node that looks like:
'{
' device_code: "SOME_CODE_STRING"
' expires_in: 500 'Expiration time in seconds
' interval: 5 ' Polling interval in seconds
' user_code: "SOME_CODE_STRING"
' verification_uri: "https://myopenpass.com/code"
' verification_uri_complete: "https://myopenpass.com/code?user_code=WI9BFFAY"
'}
m.top.authDevice = openpass_openpassrokusdk_AuthorizeDevice(clientId)
end sub
and tasks/AuthorizeDeviceTask.xml
<?xml version="1.0" encoding="utf-8"?>
<component name="AuthorizeDeviceTask" extends="Task">
<interface>
<field id="authDevice" type="node" />
</interface>
<!-- Import library for authorize device -->
<script type="text/brightscript"
uri="pkg:/source/roku_modules/openpass_openpassrokusdk/AuthorizeDeviceTask.brs" />
<script type="text/brightscript" uri="AuthorizeDeviceTask.brs" />
</component>
create a task for Authenticate Device flow: tasks/AuthenticateDeviceTask.brs
sub Init()
m.top.functionName = "CheckDeviceAuthenticated"
end sub
sub CheckDeviceAuthenticated()
' options = { polling_timeout: 200}
' options = { authenticate_url: "www.differenturl.com/authenticate", polling_timeout: 4000}
' options = { authenticate_url: "www.differenturl.com/authenticate", enable_polling: false}
' options = { enable_polling: false }
options = {}
result = openpass_openpassrokusdk_DeviceToken(m.top.clientId, m.top.deviceCode, options)
' The response will look like this
'{
' access_token: "SOME_LONG_STRING_WITH_AUTH_TOKEN"
' expires_in: 86400
' id_token: "SOME_LONG_STRING_WITH_ID_TOKEN"
' id_token_expires_in: 2592000
' refresh_token: "SOME_LONG_STRING_WITH_REFRESH_TOKEN"
' refresh_token_expires_in: 15552000
' token_type: "Bearer"
'}
m.top.authUser = result
end sub
and tasks/AuthenticateDeviceTask.xml
<?xml version="1.0" encoding="utf-8"?>
<component name="AuthenticateDeviceTask" extends="Task">
<interface>
<field id="authUser" type="node" />
</interface>
<!-- Import library for authenticate device -->
<script type="text/brightscript"
uri="pkg:/source/roku_modules/openpass_openpassrokusdk/AuthenticateDeviceTask.brs" />
<script type="text/brightscript" uri="AuthenticateDeviceTask.brs" />
</component>
sub DeviceAuthorization()
m.authTask = CreateObject("roSGNode", "AuthorizeDeviceTask")
m.authTask.ObserveField("authDevice", "OnAuthDeviceCompleted")
m.authTask.control = "run"
end sub
sub OnAuthDeviceCompleted()
' this will hold the response from AuthorizeDeviceTask and get you the user_code for the device
m.SigningScreen.authDevice = m.authTask.authDevice
' After we get the device authorization, we can start doing the polling
CheckAuthToken()
end sub
sub CheckAuthToken()
m.authenticateDeviceTask = CreateObject("roSGNode", "AuthenticateDeviceTask")
' attach device code to task
m.authenticateDeviceTask.addFields({
deviceCode: m.authTask.authDevice.device_code,
clientId: m.authTask.authDevice.client_id
})
m.authenticateDeviceTask.ObserveField("authUser", "OnAuthenticateTaskCompleted")
m.authenticateDeviceTask.control = "run"
end sub
sub OnAuthenticateTaskCompleted()
' Do what you need with the response
end sub
The OpenPass SDK is a standalone headless library defined and managed by the Roku Package Manager. As such the OpenPass SDK
is the primary way for developing the SDK. Use VSCode to open openpass-roku-sdk
to begin development.
Start your dev Server: yarn start
or bsc --watch --deploy --host <YOUR_DEVICE_HOST_IP> --password <YOUR_DEVICE_PASSWORD>
Lint the project: yarn start
or bsc --create-package false --copy-to-staging false
See Tests README.
npm run docs
OpenPass is released under the MIT license. See LICENSE for details.
FAQs
OpenPass SSO Roku SDK
The npm package @openpass/openpass-roku-sdk receives a total of 6 weekly downloads. As such, @openpass/openpass-roku-sdk popularity was classified as not popular.
We found that @openpass/openpass-roku-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.