'],
);
+
+
+ String authorizationSuccessHtml = '''
+
+
+
+ Authorization Success
+
+
+ Authorization Successful
+ You have successfully authorized the application.
+
+
+
+''';
+
+ await OAuth2.login(
+ googleConfiguration,
+ redirect: (uri) async {
+ print(uri.toString());
+ // Open the authorization URL in the user's browser
+ // Example: await launch('$uri');
+ },
+ redirectPage: authorizationSuccessHtml,
+ contentType: 'text/html',
+ );
+
+
}
diff --git a/lib/oauth_manager.dart b/lib/oauth2_manager.dart
similarity index 100%
rename from lib/oauth_manager.dart
rename to lib/oauth2_manager.dart
diff --git a/lib/src/oauth.dart b/lib/src/oauth.dart
index a4f788e..6fc7498 100644
--- a/lib/src/oauth.dart
+++ b/lib/src/oauth.dart
@@ -1,4 +1,4 @@
-import 'package:oauth2_manager/oauth_manager.dart';
+import 'package:oauth2_manager/oauth2_manager.dart';
import 'package:oauth2_manager/src/typedef.dart';
import 'oauth2_manager.dart';
diff --git a/lib/src/oauth2_manager.dart b/lib/src/oauth2_manager.dart
index 9650de5..d731c37 100644
--- a/lib/src/oauth2_manager.dart
+++ b/lib/src/oauth2_manager.dart
@@ -3,7 +3,7 @@ import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:oauth2/oauth2.dart' as oauth2;
-import 'package:oauth2_manager/oauth_manager.dart';
+import 'package:oauth2_manager/oauth2_manager.dart';
import 'package:oauth2_manager/src/typedef.dart';
/// An abstract class for managing OAuth2 authentication.
@@ -12,7 +12,7 @@ abstract class BaseOAuth2Manager {
/// Starts a local server and listens for the redirect URI.
///
- /// The `redirectPage` argument is the HTML page to display to the user after the redirect URI is received.
+ /// The `redirectPage` argument is the HTML page.html to display to the user after the redirect URI is received.
/// The `contentType` argument is the content type of the response.
///
/// Returns a `Map` of the query parameters in the redirect URI.
@@ -35,7 +35,7 @@ abstract class BaseOAuth2Manager {
}
/// This class extends the BaseOAuth2Manager class and implements the OAuth2 Authorization Code Grant flow.
-/// It uses a HttpServer to receive the authorization code and a redirect function to open the authorization page in the user's browser.
+/// It uses a HttpServer to receive the authorization code and a redirect function to open the authorization page.html in the user's browser.
class OAuth2Manager extends BaseOAuth2Manager {
/// The OAuth2 configuration.
final OAuth2Configuration _configuration;
@@ -45,10 +45,10 @@ class OAuth2Manager extends BaseOAuth2Manager {
}) : _configuration = configuration;
/// This method initiates the OAuth2 flow by creating a HttpServer to receive the authorization code,
- /// opening the authorization page in the user's browser, and handling the authorization response to obtain an OAuth2 token.
+ /// opening the authorization page.html in the user's browser, and handling the authorization response to obtain an OAuth2 token.
///
- /// [redirect] The function used to open the authorization page in the user's browser.
- /// [redirectPage] The page to display to the user after the redirect URI is received.
+ /// [redirect] The function used to open the authorization page.html in the user's browser.
+ /// [redirectPage] The page.html to display to the user after the redirect URI is received.
/// [contentType] The content type of the redirectPage.
Future login({
required RedirectUri redirect,
diff --git a/pubspec.yaml b/pubspec.yaml
index 6ca778f..164dc1d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -4,11 +4,12 @@ version: 1.0.0
repository: https://github.com/Abbas1Hussein/oauth2_manager
environment:
- sdk: '>=2.19.0 <3.0.0'
+ sdk: '>=2.19.0 <4.0.0'
dependencies:
- oauth2: ^2.0.1
+ oauth2: ^2.0.2
+ http: ^1.1.0
dev_dependencies:
- lints: ^2.0.1
- test: ^1.24.2
+ lints: ^2.1.1
+ test: ^1.24.5