ArchitectureAuthentication
OAuth2
OAuth2 authentication provides secure access to external services without sharing passwords. It uses access tokens that can be refreshed and provides fine-grained permissions.
Basic Usage
import * as i from '@xentom/integration-framework';
export default i.integration({
auth: i.auth.oauth2({
authUrl: 'https://github.com/login/oauth/authorize',
tokenUrl: 'https://github.com/login/oauth/access_token',
scopes: ['admin:repo_hook', 'admin:org', 'repo'],
}),
nodes: {
getUser: i.nodes.callable({
inputs: {
id: i.pins.data({
control: i.controls.text({
label: 'User ID',
}),
}),
},
outputs: {
user: i.pins.data(),
},
async run({ auth, inputs, next }) {
const response = await fetch(`https://api.example.com/users/${inputs.id}`, {
headers: {
Authorization: `Bearer ${auth.accessToken}`,
},
});
return next({
user: await response.json(),
});
},
}),
},
});Configuration Options
Prop
Type
Token
Token authentication is the simplest and most common authentication method. It uses a secret token to authenticate requests to external services.
Environment Variables
Environment variables are global configuration values set during integration setup. They store sensitive information like API keys, configuration options, and settings that apply to the entire integration.