From 536c82ec247c43fcff99f3214cc1fc83ddd79db8 Mon Sep 17 00:00:00 2001 From: Abbas Hussein <112737126+Abbas1Hussein@users.noreply.github.com> Date: Mon, 8 May 2023 17:14:44 +0300 Subject: [PATCH] AbbasHussein --- example/oauth2_manager_example.dart | 78 ++++++++++++++++++++--------- lib/oauth_manager.dart | 3 +- 2 files changed, 55 insertions(+), 26 deletions(-) diff --git a/example/oauth2_manager_example.dart b/example/oauth2_manager_example.dart index ba47c00..c50402b 100644 --- a/example/oauth2_manager_example.dart +++ b/example/oauth2_manager_example.dart @@ -1,37 +1,67 @@ import 'package:oauth2_manager/oauth_manager.dart'; main() async { + /// Google + final googleConfiguration = OAuth2Configuration( + clientID: '', + clientSecret: '', + authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth', + tokenEndpoint: 'https://oauth2.googleapis.com/token', + scopes: [''], + ); + + /// Facebook + final facebookConfiguration = OAuth2Configuration( + clientID: '', + clientSecret: '', + authorizationEndpoint: 'https://www.facebook.com/v12.0/dialog/oauth', + tokenEndpoint: 'https://graph.facebook.com/v12.0/oauth/access_token', + scopes: [''], + ); + + /// Twitter + final twitterConfiguration = OAuth2Configuration( + clientID: '', + clientSecret: '', + authorizationEndpoint: 'https://api.twitter.com/oauth/authenticate', + tokenEndpoint: 'https://api.twitter.com/oauth/access_token', + scopes: [''], + ); - final oauth2Configuration = OAuth2Configuration( + /// Github + final githubConfiguration = OAuth2Configuration( clientID: '', clientSecret: '', - tokenEndpoint: '', - authorizationEndpoint: '', + authorizationEndpoint: 'https://github.com/login/oauth/authorize', + tokenEndpoint: 'https://github.com/login/oauth/access_token', scopes: [''], ); - final credentials = await OAuth2.login( - oauth2Configuration, - redirect: (uri) async { - // Open the authorization URL in the user's browser - // Example: await launch('$uri'); - }, - redirectPage: '', - contentType: '', + /// LinkedIn + final linkedInConfiguration = OAuth2Configuration( + clientID: '', + clientSecret: '', + authorizationEndpoint: 'https://www.linkedin.com/oauth/v2/authorization', + tokenEndpoint: 'https://www.linkedin.com/oauth/v2/accessToken', + scopes: [''], ); - // credentials.accessToken - // credentials.refreshToken, - // credentials.idToken, - // credentials.expiration - // credentials.isExpired - // credentials.canRefresh + /// Microsoft + final microsoftConfiguration = OAuth2Configuration( + clientID: '', + clientSecret: '', + authorizationEndpoint: + 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize', + tokenEndpoint: 'https://login.microsoftonline.com/common/oauth2/v2.0/token', + scopes: [''], + ); - final newCredentials = await OAuth2.getRefreshToken( - credentials.refreshToken!, - newScopes: [''], - clientID: oauth2Configuration.clientID, - clientSecret: oauth2Configuration.clientSecret!, - tokenEndpoint: oauth2Configuration.authorizationEndpoint, + /// Amazon + final amazonConfiguration = OAuth2Configuration( + clientID: '', + clientSecret: '', + authorizationEndpoint: 'https://www.amazon.com/ap/oa', + tokenEndpoint: 'https://api.amazon.com/auth/o2/token', + scopes: [''], ); -} \ No newline at end of file +} diff --git a/lib/oauth_manager.dart b/lib/oauth_manager.dart index bf36fc0..4431ef5 100644 --- a/lib/oauth_manager.dart +++ b/lib/oauth_manager.dart @@ -1,4 +1,3 @@ -export 'package:oauth2_manager/src/oauth2_manager.dart'; export 'package:oauth2_manager/src/oauth.dart'; export 'package:oauth2_manager/src/oauth2_configuration.dart'; -export 'package:oauth2/oauth2.dart'; +export 'package:oauth2/oauth2.dart' show Credentials;