-
Notifications
You must be signed in to change notification settings - Fork 26
clientViaToken support? #10
Comments
You should be able to create this with the existing library, somehow like this (untested):
|
So currently the following snippet would be necessary: chrome.identity.getAuthToken().then((token) {
var client = new http.Client();
var expiryDate = ???;
var accessToken = new AccessToken('Bearer', token, expiryDate);
var accessCredentials = new AccessCredentials(token, null, [...]);
var authClient = authenticatedClient(client, accessCredentials)
}); I see that this is a bit unconvenient :-/ Does the Chrome Extension Identity API give you an expiry date as well? How do we know for how long the access token will be valid? |
Hah, seems we took about the same time to write this up :) The Chrome Extension Identity API only returns a token without any extra information. The suggested approach there is to just call See: https://developer.chrome.com/apps/identity#method-getAuthToken |
Thank you both. But Scarygami, I don't find BrowserClient class... 😢 |
It's in So don't use |
Yep, better 👍 And what about this message when I use dart2js ****************************************************************
* WARNING: dart:mirrors support in dart2js is experimental,
* and not recommended.
* This implementation of mirrors is incomplete,
* and often greatly increases the size of the generated
* JavaScript code.
*
* Your app imports dart:mirrors via:
* main.dart => package:googleapis => package:http => dart:mirrors
* main.dart => package:googleapis_auth => package:http => dart:mirrors
*
* Starting with Dart 1.9, you must use the
* --enable-experimental-mirrors command-line flag to opt-in.
* You can begin using this flag now if mirrors support is critical.
*
* To learn what to do next, please visit:
* http://dartlang.org/dart2js-reflection
**************************************************************** |
It could be possible to get an http_client via token?
Example, I use Chrome Extension Identity API
The text was updated successfully, but these errors were encountered: