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

Side by Side Diff: pkg/oauth2/lib/src/credentials.dart

Issue 12295014: Remove deprecated Strings class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « pkg/oauth2/lib/src/authorization_code_grant.dart ('k') | pkg/oauth2/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 library credentials; 5 library credentials;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:json' as JSON; 8 import 'dart:json' as JSON;
9 import 'dart:uri'; 9 import 'dart:uri';
10 10
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 var fields = { 165 var fields = {
166 "grant_type": "refresh_token", 166 "grant_type": "refresh_token",
167 "refresh_token": refreshToken, 167 "refresh_token": refreshToken,
168 // TODO(nweiz): the spec recommends that HTTP basic auth be used in 168 // TODO(nweiz): the spec recommends that HTTP basic auth be used in
169 // preference to form parameters, but Google doesn't support that. 169 // preference to form parameters, but Google doesn't support that.
170 // Should it be configurable? 170 // Should it be configurable?
171 "client_id": identifier, 171 "client_id": identifier,
172 "client_secret": secret 172 "client_secret": secret
173 }; 173 };
174 if (!scopes.isEmpty) fields["scope"] = Strings.join(scopes, ' '); 174 if (!scopes.isEmpty) fields["scope"] = scopes.join(' ');
175 175
176 return httpClient.post(tokenEndpoint, fields: fields); 176 return httpClient.post(tokenEndpoint, fields: fields);
177 }).then((response) { 177 }).then((response) {
178 return handleAccessTokenResponse( 178 return handleAccessTokenResponse(
179 response, tokenEndpoint, startTime, scopes); 179 response, tokenEndpoint, startTime, scopes);
180 }).then((credentials) { 180 }).then((credentials) {
181 // The authorization server may issue a new refresh token. If it doesn't, 181 // The authorization server may issue a new refresh token. If it doesn't,
182 // we should re-use the one we already have. 182 // we should re-use the one we already have.
183 if (credentials.refreshToken != null) return credentials; 183 if (credentials.refreshToken != null) return credentials;
184 return new Credentials( 184 return new Credentials(
185 credentials.accessToken, 185 credentials.accessToken,
186 this.refreshToken, 186 this.refreshToken,
187 credentials.tokenEndpoint, 187 credentials.tokenEndpoint,
188 credentials.scopes, 188 credentials.scopes,
189 credentials.expiration); 189 credentials.expiration);
190 }); 190 });
191 } 191 }
192 } 192 }
OLDNEW
« no previous file with comments | « pkg/oauth2/lib/src/authorization_code_grant.dart ('k') | pkg/oauth2/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698