Skip to content

Feathers Cloud Auth

Feathers Cloud Auth adds secure authentication to any JavaScript and TypeScript application. It works with NodeJS, Cloudflare Workers, Deno or BunJS and even on websites with no server at all.


The following example adds Feathers Cloud Auth on a client. It makes authenticated request to an API and redirects the user to the login screen if they need to log in.

It can be used with any frontend framework like React, VueJS, Angular etc.

npm i @featherscloud/auth
import { LoginRequiredError, createClient } from '@featherscloud/auth'

const auth = createClient({
  appId: '<app-did>'

try {
  // Create the authorization header for each request
  const authorization = await auth.getBearerToken()
  // Get data with authentication from your server
  const response = await fetch('http://localhost:3030', {
    headers: { authorization }
  console.log(await response.json())
catch (error: unknown) {
  // Redirect to the login page when login is required
  if (error instanceof LoginRequiredError)
    window.location.href = error.loginUrl
    throw error


Once the login is successful, the request can be authenticated in a request handler on the server like this:

import { createVerifier } from '@featherscloud/auth'

const verifier = createVerifier({
  appId: '<app-did>'

const { user } = verifier.verifyHeader(request.header.authorization)
// User has and which is the Feathers Cloud Auth user id

Last updated: