forIdToken method

Future<Client> forIdToken (
  1. String idToken
)

Implementation

static Future<Client> forIdToken(String idToken) async {
  var token = JsonWebToken.unverified(idToken);
  var claims = new OpenIdClaims.fromJson(token.claims.toJson());
  if (claims.issuer == null) throw new ArgumentError("Token has no issuer.");
  var issuer = await Issuer.discover(claims.issuer);
  if (!await token.verify(issuer._keyStore)) {
    throw new ArgumentError("Unable to verify token");
  }
  var clientId = claims.authorizedParty ?? claims.audience.single;
  return new Client(issuer, clientId);
}