Skip to content

codehelios/verify-tokenid

Repository files navigation

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 tokenId = "<ID_TOKEN>"

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

Parameter Type Description
token string Required. Firebase ID Token
audience string Required. 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.
issure string Required. Must be https://securetoken.google.com/<projectId>, where <projectId> is the same project ID used for aud above.

Returns

object containing { isValid, decoded, error }

Property Type Description
isValid boolen Indicates whether given Firebase ID Token is valid or not
decoded object or null If ID Token is valid this will be decoded JWT Object { header, payload }
error string or null If isValid is false then this will be error message saying why isValid is false otherwise null

 

License

MIT

 

Authors

 

Acknowledgements

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 2

  •  
  •