Public Pages

Sometimes you may need to create pages that do not require an account to access. For example, you may want to create a special public search page.

 

There are two types of public pages:

  • Public Page No Token: This is a public page with no token in the URL. 
  • Public Page with Token: This is a public page with a token in the URL (hard to guess). This is ideal for account generated access.  Ie: A user wishes to make some data public.
    • These tokens are managed by account admins & are currently stored in the tenant's UP stream on the Medium One platform

Configuring the portal

Before you can use public pages, you must edit the Advanced Config. As a super admin, go to "Developer" > "Advanced Config".

Enable Public Pages

Add "ENABLE_PUBLIC_PAGES": true, to the config dictionary and save. For more information about the advanced config, read our doc Advanced Config.

Specify Public Endpoint Policy

If your public page is making any API calls to the IoT platform, you should use this tag as well. For security, you should only allow public endpoints to read and write data from specific streams or tags. Add the tag "PUBLIC_ENDPOINT_POLICY". The value is a dictionary where the keys are public endpoints and the values are a list of streams and tags allowed to be accessed by that endpoint. 

Example:

"PUBLIC_ENDPOINT_POLICY": {
"public_device_data_by_stream_v2": [
"courses",
"faculty_accounts",
"studio_accounts",
"licensee_accounts",
"public_user_data",
"programs"
]
}

Setting up the page

When editing a custom dashboard page, you can select the user role "Public Page Token" or "Public Page No Token". 

No token

If you choose no token, after saving the dashboard, your page is ready to be publicly accessed at the URL https://<PORTAL URL>/public/<PAGE ROUTE>

Token

If you choose token, you must set up another page in order to allow accounts to generate and manage their public tokens.

Here is the sample code for this page:

Name the custom page as you like and be sure to set the access to "Account Admin". When you are within an account (either by switching to account view or by logging in as an account admin), you should be able to access this page and create tokens.

Screen_Shot_2019-12-09_at_4.18.47_PM.png

The public token page URL will have the following format:

https://<PORTAL URL>/token_page/<PAGE ROUTE>/<ACCOUNT ID>/<TOKEN>