ArchitectureAuthentication

Token

Token authentication is the simplest and most common authentication method. It uses a secret token to authenticate requests to external services.

Basic Usage

src/index.ts
import * as i from '@xentom/integration-framework';

export default i.integration({
  auth: i.auth.token(),

  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.token}`,
          },
        });

        return next({
          user: await response.json(),
        });
      },
    }),
  },
});

Configuration Options

Prop

Type

On this page