Authentication ๐
Keep your workflows secure with simple bearer token authentication. Let's get you set up!
Bearer Token Authentication
Getting started is super easy! All you need is your access token in the Authorization header. Grab your token from the Graph Compose dashboard and you're ready to go:
Example request with bearer token
curl https://api.graphcompose.io/workflows \
-H "Authorization: Bearer {key}"
๐ก Pro tip: Always keep your token secure and rotate it if you think it might be compromised.
Using the SDK โจ
Authenticating with the @graph-compose/client
package is straightforward.
Environment Variable (Recommended)
The most common way is to store your token in an environment variable (e.g., GRAPH_COMPOSE_TOKEN
) and pass it during client initialization:
Setting the environment variable
export GRAPH_COMPOSE_TOKEN=your_token_here
SDK initialization reading from environment variable
import { GraphCompose } from '@graph-compose/client'
// Read the token from the environment variable
const client = new GraphCompose({
token: process.env.GRAPH_COMPOSE_TOKEN
})
Explicit Initialization
Alternatively, you can pass your token string directly:
SDK initialization with explicit token string
import { GraphCompose } from '@graph-compose/client'
const client = new GraphCompose({
token: 'your_token_here'
})
Best Practices ๐ก
Keep your tokens safe and sound:
- ๐ซ Never commit tokens to version control
- ๐ Use environment variables in production
- ๐ Rotate tokens regularly
- ๐ฅ Update tokens when team members change
- โก Set proper permissions in the dashboard
Ready to start building? Let's go! ๐