oauth2_client 4.0.1 copy "oauth2_client: ^4.0.1" to clipboard
oauth2_client: ^4.0.1 copied to clipboard

Flutter library for interacting with OAuth2 servers, with classes for transparent authorized requests, secure token storage, automatic token refreshing.

example/example.dart

// ignore_for_file: avoid_print

import 'package:oauth2_client/google_oauth2_client.dart';
import 'package:oauth2_client/oauth2_helper.dart';

class Oauth2ClientExample {
  Oauth2ClientExample();

  Future<void> fetchFiles() async {
    var hlp = OAuth2Helper(
      GoogleOAuth2Client(
          redirectUri: 'com.teranet.app://oauth2redirect',
          customUriScheme: 'com.teranet.app'),
      grantType: OAuth2Helper.authorizationCode,
      clientId: 'XXX-XXX-XXX',
      clientSecret: 'XXX-XXX-XXX',
      scopes: ['https://www.googleapis.com/auth/drive.readonly'],
    );

    var resp = await hlp.get('https://www.googleapis.com/drive/v3/files');

    print(resp.body);
  }
}
187
likes
160
points
36.8k
downloads

Publisher

verified publisherfemtopedia.de

Weekly Downloads

Flutter library for interacting with OAuth2 servers, with classes for transparent authorized requests, secure token storage, automatic token refreshing.

Repository (GitHub)
View/report issues

Topics

#authentication #network #oauth #web

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

BSD-2-Clause (license)

Dependencies

crypto, flutter, flutter_secure_storage, flutter_web_auth_2, http, meta, random_string, web

More

Packages that depend on oauth2_client