Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: lib/src/resource_owner_password_grant.dart

Issue 1953643002: Fix all strong-mode warnings. (Closed) Base URL: git@github.com:dart-lang/oauth2.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/handle_access_token_response.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:http/http.dart' as http; 7 import 'package:http/http.dart' as http;
8 8
9 import 'client.dart'; 9 import 'client.dart';
10 import 'handle_access_token_response.dart'; 10 import 'handle_access_token_response.dart';
(...skipping 27 matching lines...) Expand all
38 bool basicAuth: true, 38 bool basicAuth: true,
39 http.Client httpClient}) async { 39 http.Client httpClient}) async {
40 var startTime = new DateTime.now(); 40 var startTime = new DateTime.now();
41 41
42 var body = { 42 var body = {
43 "grant_type": "password", 43 "grant_type": "password",
44 "username": username, 44 "username": username,
45 "password": password 45 "password": password
46 }; 46 };
47 47
48 var headers = {}; 48 var headers = <String, String>{};
49 49
50 if (identifier != null) { 50 if (identifier != null) {
51 if (basicAuth) { 51 if (basicAuth) {
52 headers['Authorization'] = basicAuthHeader(identifier, secret); 52 headers['Authorization'] = basicAuthHeader(identifier, secret);
53 } else { 53 } else {
54 body['client_id'] = identifier; 54 body['client_id'] = identifier;
55 if (secret != null) body['client_secret'] = secret; 55 if (secret != null) body['client_secret'] = secret;
56 } 56 }
57 } 57 }
58 58
59 if (scopes != null && !scopes.isEmpty) body['scope'] = scopes.join(' '); 59 if (scopes != null && !scopes.isEmpty) body['scope'] = scopes.join(' ');
60 60
61 if (httpClient == null) httpClient = new http.Client(); 61 if (httpClient == null) httpClient = new http.Client();
62 var response = await httpClient.post(authorizationEndpoint, 62 var response = await httpClient.post(authorizationEndpoint,
63 headers: headers, body: body); 63 headers: headers, body: body);
64 64
65 var credentials = await handleAccessTokenResponse( 65 var credentials = await handleAccessTokenResponse(
66 response, authorizationEndpoint, startTime, scopes); 66 response, authorizationEndpoint, startTime, scopes);
67 return new Client(credentials, identifier: identifier, secret: secret); 67 return new Client(credentials, identifier: identifier, secret: secret);
68 } 68 }
OLDNEW
« no previous file with comments | « lib/src/handle_access_token_response.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698