forIdToken static method

Future<Client> forIdToken(
  1. String idToken, {
  2. Client? httpClient,
})

Implementation

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