Skip to content
pubscout

openid_client

0.4.10+2, released 2 months ago by appsup.be

Library for working with OpenID Connect and implementing clients in Dart.

WASM-ready
$ flutter pub add openid_client
Source repository

What it does

Discovers OpenID Provider metadata, parses and validates ID tokens, and provides tools for implementing implicit and authorization code flows.

AI-written summary of version 0.4.10+2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to authenticate users via OpenID Connect or OAuth2 providers.
  • You are building a client for command line, web, or mobile applications using OIDC.

Skip it when

  • You exclusively want pre-built platform-native sign-in flows like Firebase Auth or Google Sign-In widgets.

Strengths

  • Supports multiple platforms including Android, iOS, web, Windows, macOS, and Linux.
  • Implements discovery, ID token validation, and RP initiated logout.

Weaknesses

  • Requires manual configuration for non-standard OAuth2 providers.

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
8

Requires defining redirect URIs and setting up the appropriate authentication client for your target platform (IO, browser, etc.).

import 'package:openid_client/openid_client.dart';

main() async {
  var issuer = await Issuer.discover(Issuer.google);
  var client = new Client(issuer, "client_id", "client_secret");
  var f = new Flow.authorizationCode(client);
  f.redirectUri = Uri.parse("http://localhost");
  print(f.authenticationUrl);
}

Alternatives

Packages that do the same job and could replace openid_client.

Works with

Packages commonly used together with openid_client: ones it builds on, ones built on it, and its own family.