0.3.1 • Published 1 year ago

@teamhanko/passkeys-next-auth-provider v0.3.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Hanko Passkeys Auth.js Provider

View docs on docs.hanko.io

If you already have a Next.js set up with Auth.js, you can easily passkeys to your app using @teamhanko/passkeys-next-auth-provider.

npm install @teamhanko/passkeys-next-auth-provider

In your pages/api/auth/[...nextauth].ts:

import { tenant, PasskeyProvider } from "@teamhanko/passkeys-next-auth-provider";

export default NextAuth({
	providers: [
		PasskeyProvider({
			tenant: tenant({
				tenantId: "<your tenant id>",
				apiKey: "<your secret api key>",
			}),
			async authorize({ userId }) {
				const user = db.users.find(userId);

				// Do more stuff

				return {
					id: user.id,
					name: user.username,
				};
			},
		}),
	],
});

In one of your components:

import { signInWithPasskey } from "@teamhanko/passkeys-next-auth-provider/client";

export default LoginButton() {
	return (
		<button onClick={() => signInWithPasskey({ tenantId: "<your tenant id>" })} />
	);
}
  1. make sure to pass the baseUrl to both
    tenant (in [...nextauth].ts) and
    signInWithPasskey() (in your component).

  2. get your tenant ID via the admin API

0.3.0

1 year ago

0.3.1

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.4

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago