Village Product and Developer Docs
  • 📘Welcome to Village Labs
    • Welcome to Village Labs
    • Self Service Onboarding
    • Help Pages
      • Adding and Deleting Users
      • Mapping Users to Source tool IDs
      • How to follow or unfollow other users
      • Configuring & Removing Daily Slack Notification Whitelist
      • Changing the Reporting Lines & Teams
      • Following Custom Reports
      • Google Drive Privacy: When will my documents appear in Village Reports?
    • Custom Reports
      • Creating Team Reports
      • Creating Custom Reports & Custom Prompt Library
    • Meetings
      • Connecting your Calendar
      • Configuring your Meetings
      • Meeting Summary Reports
    • Village Assistant
      • Github PR Review Tool
    • Security & Compliance
    • Data Privacy & Permissions
  • 🔌Data Connections
    • Airtable
    • Ashby
    • Clickup
      • Finding ClickUp User IDs
    • Figma
    • Github
      • Finding GitHub User IDs
    • Gitlab
    • Google - OAuth (Recommended)
    • Google - Manual Connection
    • Hubspot
    • Jira
      • Finding Jira User IDs
    • Confluence
      • Finding Confluence / Jira User IDs
    • Linear
    • Asana
    • Monday
    • Notion
    • Pipedrive
    • Slack
    • Basecamp
    • Zoom
  • 👩‍💻Legacy Developer Docs
    • Developer Quickstart
    • Village APIs: Introduction
      • Activity API
      • User Status API
      • Patch User API
      • Segments API
      • Redemption API
      • Master Award Controls
      • Connections (Referrals) APIs
      • GET APIs
    • 3rd Party Payments Integrations
    • Embedding Village Dashboards
  • 🕵️LEGACY Knowledge Base
    • Admin Quickstart
    • Referrals Support
    • The Basics of Village in 15 Minutes
    • Programs & Rules
      • Triggers
        • Activities
        • Goals
      • Conditions
        • Segment Conditions
        • Time Conditions
        • Max Budget Conditions
        • Conditional Multipliers
    • Awards
      • Monetary (Cash) Awards
      • Non-Monetary Awards
        • Funding
          • In-depth use cases for funding pools
      • Badges & Statuses
      • Award Expiration
    • Segments
      • Segmentation Use Cases
    • Rule Evaluation Logic Deep-dive
    • The Village Dashboards
      • Admin Account Creation
      • User Access Management
      • Network Settings
      • User Dashboard
    • BigQuery
    • Managing Payment Integrations
    • Referrals (Connections)
      • Pre-populating Users' Unique Referral Codes In Signup Flows & Forms
  • No and Low Code Solutions
    • No and Low Code Solutions
      • No & Low Code Solutions
  • Feedback
    • Village Docs Feedback Form
    • Feature Requests
    • Talk to our Team
Powered by GitBook
On this page
  • 1: Create a temporary auth token for the given user using your API key.
  • 2. Render the Embedded Dashboard using the user's auth token

Was this helpful?

  1. Legacy Developer Docs

Embedding Village Dashboards

Web Apps & Mobile Web View

Previous3rd Party Payments IntegrationsNextAdmin Quickstart

Last updated 1 year ago

Was this helpful?

Rendering the Village Embedded User Dashboard requires a two-step process due to requirement of not utilizing the Village API key on a client-side application.

NOTE: Village supports some sub-variations of the the below for different embed formats and development frameworks. Reach out to support@villagelabs.co if the generic solution below does not meet your needs and we can provide you with supported alternatives.

In order to render a user's dashboard, your application should do the following 2-step process.

Your app's server should make a call to the Village API in order to generate a user's auth key:

## Get User Authorization Key
curl "https://api-ledger.villagelabs.net/networks/normau/users/peter@villagelabs.co/authorization_key" \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer [API KEY]' 
}'

The response returned from the API will have token response that is valid for 24 hours and allows your client-side app to make requests to our API on behalf of the given user in order to render their dashboard.

{
  "network": "normau",
  "user": "peter@villagelabs.co",
  "token": "[TOKEN]",
  "status": "success",
  "message": "Authorization key generated successfully for the user"
}

From here, your app can use the auth token to render the embedded dashboard into any DOM element in your application.

Add the following code snipped into your page and dynamically load the user's auth token into window.village.token in order to render that user's dashboard into your app. The code below shows an example of loading the Village dashboard javascript and css code into your app and renders the dashboard into an element with the id of village-dashboard

<html>
<body>

    <div id="village-dashboard"></div>

    <script>
        window.village = window.village || {};
        window.village.root = "village-dashboard";
        window.village.token = "[USER AUTH KEY]";
    </script>
    <link href="https://embedded.villagelabs.net/index.css" rel="stylesheet">
    <script crossorigin type="module" src="https://embedded.villagelabs.net/index.js"></script>
</body>

👩‍💻
1: Create a temporary auth token for the given user using your API key.
2. Render the Embedded Dashboard using the user's auth token