oauth2_client 1.3.2 oauth2_client: ^1.3.2 copied to clipboard
Flutter library for interacting with standard or custom OAuth 2 servers. Provides convenience classes for secure token storage and automatic token refeshing.
import 'package:oauth2_client/oauth2_helper.dart';
import 'package:oauth2_client/google_oauth2_client.dart';
class Oauth2ClientExample {
Oauth2ClientExample();
Future<void> fetchFiles() async {
var hlp = OAuth2Helper(GoogleOAuth2Client(
redirectUri: 'com.teranet.app:/oauth2redirect',
customUriScheme: 'com.teranet.app'));
hlp.setAuthorizationParams(
grantType: OAuth2Helper.AUTHORIZATION_CODE,
clientId: '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);
}
}