Skip to main content

Step 1: Create View Template

Add a container element in your ERB template:

Step 2: Add JavaScript Initialization

Create a JavaScript file or add to your existing pack:

Choose what data to sync

An entity is a type of data, such as people, notes, or tasks. People sync automatically where supported. The examples below enable optional notes and tasks with entitiesToSync; choose the types your app needs. Alternatively, omit this prop to use the defaults you choose in dashboard Settings. An explicit selection in code takes precedence over those defaults. This configures new connections. For other types or accounts that are already connected, see Choose what data to sync.

Step 3: Add Rails Route

Create a route to handle token generation:

Step 4: Create Controller

Implement token generation in a controller:

Step 5 (Optional): Handle Credential Events

Add event handling in the JavaScript:

Step 6: Update CSP

Update config/initializers/content_security_policy.rb:

Alternative to CSP

You can also use nonces or hashes for better security, but that’s more complex to set up with dynamic imports. If you want to go that route, you’d need to:
And then update your JavaScript to include the nonce: