

CentralAuth is a passwordless authentication platform for web apps, native apps and desktop apps.
It provides secure login and session management so users can log in safely at any application.







import { CentralAuthClass } from 'centralauth/server';
export const GET = async (req, props) => {
const params = await props.params;
const { action } = params;
const headerList = await headers();
const auth = new CentralAuthClass({
clientId: '<YOUR_CLIENT_ID>',
secret: '<YOUR_CLIENT_SECRET',
authBaseUrl: 'https://centralauth.com',
callbackUrl: '/auth/callback'
});
//Redirect to login
if (action == "login")
return await auth.login(req);
//Handle callback
if (action == "callback")
const user = await auth.callback();
//Get user information
return await auth.user(headerList);
}