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.
Setting up the page
When editing a custom dashboard page, you can select the user role "Public Page Token" or "Public Page 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>
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.
The public token page URL will have the following format:
https://<PORTAL URL>/token_page/<PAGE ROUTE>/<ACCOUNT ID>/<TOKEN>