Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/deftomat/just_google_jwt_decoder

A Google JWT decoder library for Dart.
https://github.com/deftomat/just_google_jwt_decoder

dart google-jwt google-signin jwt server

Last synced: 17 days ago
JSON representation

A Google JWT decoder library for Dart.

Awesome Lists containing this project

README

        

# Just Google JWT decoder

A simple Google JWT decoder library for Dart with all necessary verifiers.

## Usage

```dart
import 'package:just_google_jwt_decoder/just_google_jwt_decoder.dart';

main() async {
var clientId = '';
var decoder = new GoogleJwtDecoder(clientId, expirationTolerance: const Duration(seconds: 30));

var encodedJwt = new EncodedJwt('');
var jwt = await decoder.convert(encodedJwt);

print(jwt.payload);
}
```

## Verification

Library verifies following data:
- Whether issuer is Google Accounts server
- Whether user's email is verified
- Whether JWT not expires
- Whether audience is equal to Client ID
- Whether signature is valid (automatically downloads certificates from Google servers and keep them in memory until they expires).

## Get Google JWT

You can obtain a Google JWT (a.k.a. *idToken*) with [just_google_signin](https://github.com/deftomat/just_google_signin) library.