Skip to content

Commit

Permalink
Update github client
Browse files Browse the repository at this point in the history
  • Loading branch information
okrad committed Sep 20, 2022
1 parent f7e0506 commit 4d80697
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions lib/github_oauth2_client.dart
Original file line number Diff line number Diff line change
@@ -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
///
Expand All @@ -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<AccessTokenResponse> getTokenWithAuthCodeFlow(
{required String clientId,
List<String>? scopes,
String? clientSecret,
bool enablePKCE = true,
bool enableState = true,
String? state,
String? codeVerifier,
Function? afterAuthorizationCodeCb,
Map<String, dynamic>? authCodeParams,
Map<String, dynamic>? accessTokenParams,
Map<String, String>? accessTokenHeaders,
httpClient,
BaseWebAuth? webAuthClient,
Map<String, dynamic>? 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);
}
}

0 comments on commit 4d80697

Please sign in to comment.