Skip to content

Latest commit

 

History

History
76 lines (54 loc) · 4.13 KB

README.md

File metadata and controls

76 lines (54 loc) · 4.13 KB

Note As part of our ongoing commitment to best security practices, we have rotated the signing keys used to sign previous releases of this SDK. As a result, new patch builds have been released using the new signing key. Please upgrade at your earliest convenience.

While this change won't affect most developers, if you have implemented a dependency signature validation step in your build process, you may notice a warning that past releases can't be verified. This is expected, and a result of the key rotation process. Updating to the latest version will resolve this for you.

JWTDecode.Android

CircleCI Maven Central codecov javadoc

📚 Documentation • 🚀 Getting Started • 💬 Feedback

Documentation

Getting Started

Installation

The library is be available both in Maven Central and JCenter. To start using it add this line to your build.gradle dependencies file:

implementation 'com.auth0.android:jwtdecode:2.0.2'

Usage

Decode a JWT token

String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ";
JWT jwt = new JWT(token);

String issuer = jwt.getIssuer(); //get registered claims
String claim = jwt.getClaim("isAdmin").asString(); //get custom claims
boolean isExpired = jwt.isExpired(10); // Do time validation with 10 seconds leeway

A DecodeException will raise with a detailed message if the token has:

  • An invalid part count.
  • A part not encoded as Base64 + UTF-8.
  • A Header or Payload without a valid JSON format.

Checkout EXAMPLES for more details on how to use the library

Feedback

Contributing

We appreciate feedback and contribution to this repo! Before you get started, please see the following:

Raise an issue

To provide feedback or report a bug, please raise an issue on our issue tracker.

Vulnerability Reporting

Please do not report security vulnerabilities on the public Github issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.


Auth0 Logo

Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout Why Auth0?

This project is licensed under the MIT license. See the LICENSE file for more info.