Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hostedDomain parameter #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/src/browser/google_oauth2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class GoogleOAuth2 extends OAuth2<Token> {
final List<String> _request_visible_actions;
final String _provider;
final String _tokenValidationUri;
final String _hostedDomain;
final Function _tokenLoaded;
final Function _tokenNotLoaded;
String _approval_prompt;
Expand All @@ -28,6 +29,8 @@ class GoogleOAuth2 extends OAuth2<Token> {
*
* * [provider] the URI to provide Google OAuth2 authentication.
* * [tokenValidationUri] the URI to validate OAuth2 tokens against.
* * [hostedDomain] restricts login to a Google Apps domain, see
* https://developers.google.com/accounts/docs/OpenIDConnect#hd-param
* * [clientId] Client id for the Google API app. For example, for Google
* Books, use "796343192238.apps.googleusercontent.com".
* * [scopes] list of scopes (kinds of information) you are planning to use.
Expand All @@ -45,13 +48,15 @@ class GoogleOAuth2 extends OAuth2<Token> {
{ List<String> request_visible_actions: null,
String provider: "https://accounts.google.com/o/oauth2/",
String tokenValidationUri: "https://www.googleapis.com/oauth2/v1/tokeninfo",
String hostedDomain: "",
tokenLoaded(Token token),
tokenNotLoaded(),
bool autoLogin: false,
bool autoLoadStoredToken: true,
String approval_prompt: null})
: _provider = provider,
_tokenValidationUri = tokenValidationUri,
_hostedDomain = hostedDomain,
_tokenLoaded = tokenLoaded,
_tokenNotLoaded = tokenNotLoaded,
_request_visible_actions = request_visible_actions,
Expand Down Expand Up @@ -116,7 +121,8 @@ class GoogleOAuth2 extends OAuth2<Token> {
"redirect_uri": "postmessage", // Response will post to the proxy iframe
"scope": _scopes.join(" "),
"immediate": immediate,
"approval_prompt": _approval_prompt
"approval_prompt": _approval_prompt,
"hd": _hostedDomain
};
if (_request_visible_actions != null && _request_visible_actions.length > 0) {
queryParams["request_visible_actions"] = _request_visible_actions.join(" ");
Expand Down