Socket
Book a DemoInstallSign in
Socket

@tailor-platform/auth

Package Overview
Dependencies
Maintainers
0
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tailor-platform/auth

This package provides ways to handle Tailor authentication

3.0.0
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

This package provides ways to handle Tailor authentication

Getting Started

The example steps below describes how to add authentication with Tailor Platform to your app.

Install

npm install --save @tailor-platform/auth

Configuration

Create your own instance of {@link core.Config | Config }.

import { Config } from "@tailor-platform/auth/core";

export const config = new Config({
  apiHost: "http://yourapp.erp.dev",
  appHost: "http://localhost:3000",
});

Add Next.js middleware

Use {@link server.withAuth | withAuth } to add Next.js middleware with your configuration.

import { withAuth } from "@tailor-platform/auth/server";
import { config as authConfig } from "@/libs/authConfig";

const middleware = withAuth(authConfig);

export default middleware;

Mount React provider

Use {@link client.TailorAuthProvider} to authentication on client components.

import { TailorAuthProvider } from "@tailor-platform/auth/client";
import { config } from "@/libs/authConfig";

export const Providers = ({ children }: { children: ReactNode }) => (
 <TailorAuthProvider config={config}>{children}</TailorAuthProvider>
);

Authenticate

Use {@link client.useAuth | useAuth } hook to initiate the authentication.

"use client";
import { useAuth } from "@tailor-platform/auth/client";

const Component = async () => {
  const { login } = useAuth();
  const doLogin = useCallback(() => {
    login({
      name: "saml", // strategy name
      options: {
        redirectPath: "/dashboard",
      },
    });
  }, [login]);

  return (
    <div>
      <button onClick={doLogin}>Login</button>
    </div>
  );
};

More

This package has still more functionalities.

Server

A set of functionss for server components ({@link server.getServerSession | getServerSession}) are also available.

Integration with apollo-client

A custom ApolloLink is available. See @tailor-platform/auth-apollo for more information.

Customization

Pluggable authentication adapters are supported. See {@link core.AbstractStrategy | AbstractStrategy} for more information.

FAQs

Package last updated on 12 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.