diff --git a/lib/github_oauth2_client.dart b/lib/github_oauth2_client.dart index 08203c1..a291d38 100644 --- a/lib/github_oauth2_client.dart +++ b/lib/github_oauth2_client.dart @@ -1,4 +1,6 @@ +import 'package:oauth2_client/access_token_response.dart'; import 'package:oauth2_client/oauth2_client.dart'; +import 'src/base_web_auth.dart'; /// Implements an OAuth2 client against GitHub /// @@ -11,7 +13,41 @@ class GitHubOAuth2Client extends OAuth2Client { authorizeUrl: 'https://github.com/login/oauth/authorize', tokenUrl: 'https://github.com/login/oauth/access_token', redirectUri: redirectUri, - customUriScheme: customUriScheme) { - accessTokenRequestHeaders = {'Accept': 'application/json'}; + customUriScheme: customUriScheme); + + @override + Future getTokenWithAuthCodeFlow( + {required String clientId, + List? scopes, + String? clientSecret, + bool enablePKCE = true, + bool enableState = true, + String? state, + String? codeVerifier, + Function? afterAuthorizationCodeCb, + Map? authCodeParams, + Map? accessTokenParams, + Map? accessTokenHeaders, + httpClient, + BaseWebAuth? webAuthClient, + Map? webAuthOpts}) async { + return super.getTokenWithAuthCodeFlow( + clientId: clientId, + scopes: scopes, + clientSecret: clientSecret, + enablePKCE: enablePKCE, + enableState: enableState, + state: state, + codeVerifier: codeVerifier, + afterAuthorizationCodeCb: afterAuthorizationCodeCb, + authCodeParams: authCodeParams, + accessTokenParams: accessTokenParams, + accessTokenHeaders: { + ...?accessTokenHeaders, + ...{'Accept': 'application/json'} + }, + httpClient: httpClient, + webAuthClient: webAuthClient, + webAuthOpts: webAuthOpts); } }