Index: lib/google_signin_aware.dart |
diff --git a/lib/google_signin_aware.dart b/lib/google_signin_aware.dart |
index 6777058230c58dc4f3405fa8623c671725e2bb03..c35d7d5c59f7d866edb9213676c16de549c37e68 100644 |
--- a/lib/google_signin_aware.dart |
+++ b/lib/google_signin_aware.dart |
@@ -18,13 +18,38 @@ import 'google_js_api.dart'; |
/// (e.g do you want to allow interaction with the Google Drive API). |
/// |
/// The `google-signin-aware-success` event is triggered when a user successfully |
-/// authenticates. The `google-signin-aware-signed-out` event is triggered |
-/// when a user explicitely signs out via the google-signin element. |
+/// authenticates. If either `offline` or `offlineAlwaysPrompt` is set to true, successful |
+/// authentication will also trigger the `google-signin-offline-success`event. |
+/// The `google-signin-aware-signed-out` event is triggered when a user explicitly |
+/// signs out via the google-signin element. |
/// |
/// You can bind to `isAuthorized` property to monitor authorization state. |
/// ##### Example |
/// |
/// <google-signin-aware scopes="https://www.googleapis.com/auth/drive"></google-signin-aware> |
+/// |
+/// |
+/// ##### Example with offline |
+/// <template id="awareness" is="dom-bind"> |
+/// <google-signin-aware |
+/// scopes="https://www.googleapis.com/auth/drive" |
+/// offline |
+/// on-google-signin-aware-success="handleSignin" |
+/// on-google-signin-offline-success="handleOffline"></google-signin-aware> |
+/// <\/template> |
+/// <script> |
+/// var aware = document.querySelector('#awareness'); |
+/// aware.handleSignin = function(response) { |
+/// var user = gapi.auth2.getAuthInstance().currentUser.get(); |
+/// console.log('User name: ' + user.getBasicProfile().getName()); |
+/// }; |
+/// aware.handleOffline = function(response) { |
+/// console.log('Offline code received: ' + response.detail.code); |
+/// // Here you would POST response.detail.code to your webserver, which can |
+/// // exchange the authorization code for an access token. More info at: |
+/// // https://developers.google.com/identity/protocols/OAuth2WebServer |
+/// }; |
+/// <\/script> |
@CustomElementProxy('google-signin-aware') |
class GoogleSigninAware extends HtmlElement with CustomElementProxyMixin, PolymerBase { |
GoogleSigninAware.created() : super.created(); |
@@ -49,6 +74,11 @@ class GoogleSigninAware extends HtmlElement with CustomElementProxyMixin, Polyme |
bool get hasPlusScopes => jsElement[r'hasPlusScopes']; |
set hasPlusScopes(bool value) { jsElement[r'hasPlusScopes'] = value; } |
+ /// The Google Apps domain to which users must belong to sign in. |
+ /// See the relevant [docs](https://developers.google.com/identity/sign-in/web/reference) for more information. |
+ String get hostedDomain => jsElement[r'hostedDomain']; |
+ set hostedDomain(String value) { jsElement[r'hostedDomain'] = value; } |
+ |
/// True if authorizations for *this* element have been granted |
bool get isAuthorized => jsElement[r'isAuthorized']; |
set isAuthorized(bool value) { jsElement[r'isAuthorized'] = value; } |
@@ -57,6 +87,20 @@ class GoogleSigninAware extends HtmlElement with CustomElementProxyMixin, Polyme |
bool get needAdditionalAuth => jsElement[r'needAdditionalAuth']; |
set needAdditionalAuth(bool value) { jsElement[r'needAdditionalAuth'] = value; } |
+ /// Allows for offline `access_token` retrieval during the signin process. |
+ /// See also `offlineAlwaysPrompt`. You only need to set one of the two; if both |
+ /// are set, the behavior of `offlineAlwaysPrompt` will override `offline`. |
+ bool get offline => jsElement[r'offline']; |
+ set offline(bool value) { jsElement[r'offline'] = value; } |
+ |
+ /// Works the same as `offline` with the addition that it will always |
+ /// force a re-prompt to the user, guaranteeing that you will get a |
+ /// refresh_token even if the user has already granted offline access to |
+ /// this application. You only need to set one of `offline` or |
+ /// `offlineAlwaysPrompt`, not both. |
+ bool get offlineAlwaysPrompt => jsElement[r'offlineAlwaysPrompt']; |
+ set offlineAlwaysPrompt(bool value) { jsElement[r'offlineAlwaysPrompt'] = value; } |
+ |
/// The app activity types you want to write on behalf of the user |
/// (e.g http://schemas.google.com/AddActivity) |
String get requestVisibleActions => jsElement[r'requestVisibleActions']; |