Guides
Visit our websiteDeveloper Docs
  • Getting Started with Databrain
    • What is Databrain?
  • ❄️Onboarding & Configuration
    • 📝Sign-Up
    • ✍️Sign-In
    • ✏️Google Sign In Setup for Self-hosted app
    • 🤔Forgot password? Recover your Databrain Account
    • 🌟Onboarding
    • 💾Add a Data Source
    • 🧑Configure Tenants
    • 🆕Create a Workspace
    • 🔓Create a Private Workspace
    • 🆕Create a Dashboard
    • 💠Create a Metric
      • Create Custom Columns
      • Create a Metric using Chat Mode
      • Create a Metric using Custom SQL
    • Workspace Settings
      • General Settings
      • Access Control Settings
      • Cache Settings
      • Download Settings
    • 🗄️Explore Data
  • 🛢️Datasources
    • Connecting Data Sources to Databrain
      • Amazon Redshift
      • Snowflake
      • BigQuery
      • MySQL
      • Postgres
      • MongoDB
      • ElasticSearch
      • DataBricks
      • ClickHouse
      • MSSQL
      • Amazon S3
      • CSV
      • Firebolt
      • SingleStore
      • Athena
    • Allow Access to our IP
    • Add a Data Source
    • Configure Tenants
    • How to Sync a Data Source
    • Edit Tenancy
    • Create a Datamart
    • Semantic Layer
    • Create a Data App
    • Creating a Custom Dataset/View in a Multi-Datasource Environment
  • Workspace
    • Multi Datasource Workspace
  • 🔍DASHBOARDS
    • Edit a Dashboard
    • Share Dashboard
    • Dashboard Settings
    • Create/Modify Dashboard Filter
      • Dashboard Filter - Variable Apply On
      • Add LHS and RHS custom sql support for dashboard filter
    • Customize Layout
    • Adding Elements to Dashboard
    • Import/Export Dashboard
    • Report Scheduler
  • 📉METRIC
    • Edit a Metric
    • Joins , Filter, Sort, Group By
    • Complex Filter
    • Apply Metric Filter
      • Metric Filter - Variable
      • Metric Filter - Custom
    • Switch X axis and Switch Y axis
    • Group By
    • Footnote and Long Description
    • Dynamic Property
    • Archive/Unarchive Metric Card
    • Download Metric Card
    • Download Underlying Data
    • Metric Summary
    • Metric Expression for Single Value Card
    • AI Summary
    • Merge Metrics
    • Section Filters
    • View Unpublished Metrics
  • 📊VISUALIZATIONS - ACTIONS & APPEARANCE
    • Chart Actions
      • Chart Click Action
      • Chart Click Action with Metric
      • Card Click Action
      • Drill Down
      • Cross Dashboard Drill Down
    • Chart Appearance
      • Chart-Specific Appearance Options
  • 🛢️PREVIEW OF DASHBOARDS
    • Email Settings for Scheduled Reports
    • Scheduled Reports for End User
  • 🔍FILTERS
    • Dashboard Filter
    • Metric Filter
    • App filter
  • 💡Features
    • Python Editor Console
    • Custom SQL Console
    • Custom SQL Query Guidelines
  • 🏢Integrating Plugin
    • ✳️Get an auth token
    • 🙏Get a guest token
  • 🛃THEMEING & CUSTOMIZATION
    • 🎨Creating a theme
    • 🖼️View the theme in action
    • ⚙️Reset a saved theme
  • 📊Metric Component (upto version v0.11.15)
    • ✨Quick start
  • 🕸️Web Components
    • ✨Quick start
    • ⚛️Framework Specific Guide
  • 🚀Product Changelog
  • 🤳Self Hosted Changelog
Powered by GitBook
On this page
  1. Integrating Plugin

Get a guest token

This page will help you to get a guest token which you can use to access the dashboard metrics in your app using the databrain plugin.

PreviousGet an auth tokenNextCreating a theme

Last updated 1 year ago

Step 1: Go to the Databrain app settings and then click on the API Token tab.

Step 2: Find the API Key which has permission to access metrics and dashboards

Step 3: Open your Postman App and send a POST request to the URL - https://api.usedatabrain.com/api/v1/guest-token/create

Step 4: Then click on the Authorization tab and select the type to Bearer Token and paste the API Key you have copied from the Databrain App settings API Token tab.

Step 5: In the body tab choose raw json. We need a client id which you have to get from your user's session because ideally, you will call this API from your app only.

Step 6: The minimum json body structure should be -

 {
        "workspaceName": "your workspace name",
	“clientId”: “Your client or user Id for which you are creating this guest token”,	
}

If you want to add some Row Level of Security settings then in params you can also add another key “rlsSettings” It is an array of objects which has “metricId” - the id of the metric you want to have rls settings enabled for along with the key “values” which is an object of rls condition name and its value pair filter for the particular metric.

Now our new json body structure would be -

{
	"workspaceName": "your workspace name",
	“clientId”: “Your client or user Id for which you are creating this guest token”,
	“params: {
		“rlsSettings”: [{
			“metricId”: “The id of the metric you want to have rls filters”,
			“values”: {
				“paid_orders”: true,
				“amount”: 500
			}
		}]
	}
}

If you use SQL query to generate the metric data and want to add metric filters but don't want end users to use them then you can add appFilters

Please refer to this article to know more about app filters.

To add app filters it's the same process as rls settings. Here you have to add another key "appFilters" and then you can specify the value same as rls settings.

{
	"workspaceName": "your workspace name",
	“clientId”: “Your client or user Id for which you are creating this guest token”,
	“params: {
	...(other params),
		“appFilters”: [{
			“metricId”: “The id of the metric you want to have app filters”,
			“values”: {
				“paid_orders”: true,
				“amount”: 500,
				“country”: ["USA", "CANADA"]
			}
		}]
	}
}

Step 7: Click on the send button and in the response you will get the token. Now copy the token to use it in the plugin.

🏢
🙏
App filter