0.3.1 • Published 2 years ago

@codehelios/verify-tokenid v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Verify TokenId   MIT License NPM Verison

Lightweight zero dependency library to verify Firebase ID Token in Cloudflare Workers.

 

Usage/Examples

Verify ID Token

import { verifyTokenId } from "@codehelios/verify-tokenid";

const { isValid, decoded, error } = await verifyTokenId(tokenId, "https://securetoken.google.com/<projectId>", "<projectId>");

 

API Reference

Verify ID Token

Verifies Firebase ID Token and returns object containing { isValid, decoded, error }

  verifyTokenId(token, issure, audience)

Arguments

ParameterTypeDescription
tokenstringRequired. Firebase ID Token
issurestringRequired. Must be "https://securetoken.google.com/", where is the same project ID used for aud above.
audiencestringRequired. Must be your Firebase project ID, the unique identifier for your Firebase project, which can be found in the URL of that project's console.

Returns

object containing { isValid, decoded, error }

PropertyTypeDescription
isValidboolenIndicates whether given Firebase ID Token is valid or not
decodedobject or nullIf ID Token is valid this will be decoded JWT Object { header, payload }
errorstring or nullIf isValid is false then this will be error message saying why isValid is false otherwise null

 

License

MIT

 

Authors

 

Acknowledgements

0.3.1

2 years ago

0.3.0

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago