Skip to content

This is the authentication module for Opine, a simple npm module for verifying JWT tokens.

Notifications You must be signed in to change notification settings

Opine-official/opine-official-authentication

Repository files navigation

@opine-official/authentication

This is the authentication module for Opine, a simple npm module for verifying JWT tokens.

Installation

npm install @opine-official/authentication

Usage

import { verifyToken } from "@opine-official/authentication";

const token = "your-jwt-token";
const secretKey = "your-secret-key";

try {
  const decoded = verifyToken(token, secretKey);
  console.log(decoded);
} catch (err) {
  console.error(err.message);
}

API

verifyToken(token: string, secretKey: string): any

Verifies a JWT token.

  • token: The JWT token to verify.
  • secretKey: The secret key used to verify the token.

Returns the decoded payload if the token is valid, throws an Error otherwise.

Repository

You can find the source code for this module on GitHub.

License

MIT

Remember to replace your-jwt-token and your-secret-key with actual values when using the module. You may also want to replace MIT with the actual license you're using, and add more sections as needed, such as Contributing, Tests, and Changelog.

About

This is the authentication module for Opine, a simple npm module for verifying JWT tokens.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published