Stellate Product Updates logo
Back to Homepage Subscribe to Updates

Product Updates

See the latest new features, improvements, and product updates

Labels

  • All Posts
  • Fix
  • Announcement
  • Improvement
  • graph api
  • feature

Jump to Month

  • December 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • January 2023
  • September 2022
  • August 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
a year ago

Evaluate cookies and headers with Dynamic Scopes

Dynamic Scopes, now in Beta, lets you evaluate the contents of headers and cookies using a JS function, enabling you to define scopes dynamically. Learn more over in the docs.

import { Config } from 'stellate'
const config: Config = {
  config: {
    scopes: {
      // ctx is an object with the following properties:
      // - headers: an object with all headers of the request
      // - cookies: an object with all cookies of the request
      AUTHENTICATED: (ctx) => {
        const userId = ctx.cookies.uid
        if (!userId || userId.startsWith('lo_')) {
          return 'UNAUTHENTICATED'
        }
        return userId
      },
    },
  },
}

export default config


Avatar of authorMark Huber