← Back to Recipes

Generate a Connect Token with permissions to update an existing Item

In order to update an Item you should generate, in your server, a Connect Token linked to the Item Id you want to update.

Steps#

1. Setup SDK#

Setup the PluggyClient with your application credentials. This is very sensitive, so it must be done securely in your server-side application.

2. Select itemId you want to update#

Get the id of the Item you want to update in your Client-side application.

3. Generate Connect Token with the SDK#

Send a request to generate the Connect Token specifying the Item Id you want to update.

When using our SDK, you may use the method createConnectToken().

If integrating via API directly, then you need to call POST /connect_token.

With this token, your Client-side application (such as Pluggy Connect widget) will be able to run the Item update flow.

See our docs: Updating an Item for more info.

Code#

import { PluggyClient } from 'pluggy-sdk'
 
const { CLIENT_ID = '', CLIENT_SECRET = '' } = process.env
 
const client = new PluggyClient({
  clientId: CLIENT_ID,
  clientSecret: CLIENT_SECRET,
})
 
const ITEM_ID_TO_UPDATE = 'my-item-id-1234'
 
async function main(itemId) {
  const { accessToken: connectToken } = await client.createConnectToken(itemId)
  console.log(`Created connectToken for item id '${itemId}'`)
  return connectToken
}
 
main(ITEM_ID_TO_UPDATE)