@foundry-ai/api-auth
TypeScript icon, indicating that this package has built-in type declarations

1.3.2 • Public • Published

Foundry.ai Api Auth

This module exposes connect middleware for Foundry.ai APIs to authenticate requests.

npm install --save @foundry-ai/api-auth

Basic Usage

const apiAuth = require('@foundry-ai/api-auth');
const app = require('express');

app.use(apiAuth({
  authEndpoint: 'https://auth.myapp.com/v1/oauth2/authorization'
}));

Access Data

If authorization is successful any data returned from your auth endpoint will be attached to the request and made available via req.auth

app.use(apiAuth({
  authEndpoint: 'https://auth.myapp.com/v1/oauth2/authorization'
}));

app.get('/test', (req, res, next) => {
  console.log(req.auth)
  // { 
  //   userId: 'dfce809c-9245-551d-9312-ed3551e6bebb', 
  //   scope: '*' 
  // }
})

Package Sidebar

Install

npm i @foundry-ai/api-auth

Weekly Downloads

5

Version

1.3.2

License

MIT

Unpacked Size

21.8 kB

Total Files

10

Last publish

Collaborators

  • foundryai
  • jbender
  • njgerner
  • schmod