import { MembraneClient } from '@membranehq/sdk'
// With a static token
const membrane = new MembraneClient({
token: process.env.MEMBRANE_ACCESS_TOKEN,
})
// With dynamic token fetching — for long-lived environments (like web pages)
// where the token may expire and needs to be refreshed
const membrane = new MembraneClient({
fetchToken: async () => {
const response = await fetch('/api/membrane-token')
const { token } = await response.json()
return token
},
})