<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PP7S83N" height="0" width="0" style="display:none;visibility:hidden">
Tutorial

Set up authentication

This tutorial will guide you in importing a workflow to Retool that will connect your app with the Weavy API for authentication.

Have Retool ready, and let's get started.

1. Select Weavy environment

First we need an environment URL and an API key to communicate with the Weavy backend. 

2. Configure Weavy URL

We will store the URL to the Weavy environment in an account-level Configuration variable in your Refine account settings.

  • Go to Settings > Configuration variables in your Refine account.
    See Manage configuration variables.
  • Add a variable with the name WEAVY_URL and set it to the URL of your Weavy environment.
WEAVY_URL
WEAVY-URL

3. Configure API key

We will store the Weavy API key as a secret Configuration variable in your Refine account settings.

  • Add a secret variable with the name WEAVY_APIKEY and set it to the API key of your Weavy environment.
WEAVY_APIKEY
WEAVY-API-KEY

4. Import authentication workflow

This workflow handles the communication between Retool and Weavy API to get the authenticated user in your app, sync it with Weavy, and return an access token.

  • Download WeavyRetoolWorkflow.JSON (link below)
  • Go to Workflows in Retool
  • Click Create New and select From JSON
  • Choose to Upload a file and choose the WeavyRetoolWorkflow.json in the modal and then Create workflow
  • The settings will be picked up from the configuration variables, so all you have to do is Deploy (up to the right)
    • If the Deploy button is disabled, it's either already deployed (look for the text Latest version deployed), or some of the settings might not have loaded correctly - refresh, and it should be working.
    • Any message about no triggers configured can be ignored.
Download WeavyRetoolWorkflow.JSON

5. Use the workflow in your app

To activate and use the workflow your Retool app, you need to add a query that is using the workflow.

  • Open your app and go to the <> Code section.
  • Click on +Add query and choose Import Workflow.
  • Name the query getWeavyToken.
  • Select Workflow and choose WeavyRetoolWorkflow.
  • The Workflow parameters should be defaulted with the data shown below. Otherwise you can set it as raw data.
  • Make sure the Run behavior is Automatic.
  • Save the query and give it a run to try it out!
Workflow parameters (raw)
{ 
  "uid" : {{ current_user.sid }}, 
  "fullname" : {{ current_user.fullName }}, 
  "email" : {{ current_user.email }}, 
  "avatar" : {{ current_user.profilePhotoUrl }}
}

6. Done!

We now have the foundation to start adding Weavy features to your app.

Let's start building!

Web capture_26-8-2024_144834_ubajay.retool.com
Ask AI
Support

To access live chat with our developer success team you need a Weavy account.

Sign in or create a Weavy account