@@ -687,33 +687,29 @@ function google($q, $http, $cordovaOauthUtility) {
687
687
688
688
if ( $cordovaOauthUtility . isInAppBrowserInstalled ( ) ) {
689
689
690
- var redirect_uri = "http://localhost/callback" ,
691
- clear_cache = 'no' ,
692
- clear_session = 'no' ,
693
- approval_prompt = 'auto' ;
690
+ var redirect_uri , clear_cache , clear_session , approval_prompt , prompt , login_hint ;
691
+
692
+ options = options || { } ;
693
+
694
+ redirect_uri = options . redirect_uri || "http://localhost/callback" ;
695
+ clear_cache = options . clear_cache === true ? 'yes' : 'no' ;
696
+ clear_session = options . clear_session === true ? 'yes' : 'no' ;
697
+ approval_prompt = options . approval_prompt === true ? 'force' : 'auto' ;
698
+ prompt = options . prompt === true ? 'select_account' : 'consent select_account' ;
699
+ login_hint = options . login_hint || '' ;
694
700
695
- if ( options !== undefined ) {
696
- if ( options . hasOwnProperty ( "redirect_uri" ) ) {
697
- redirect_uri = options . redirect_uri ;
698
- }
699
- if ( options . hasOwnProperty ( "clear_cache" ) ) {
700
- clear_cache = options . clear_cache === true ? 'yes' : 'no' ;
701
- }
702
- if ( options . hasOwnProperty ( "clear_session" ) ) {
703
- clear_session = options . clear_session === true ? 'yes' : 'no' ;
704
- }
705
- if ( options . hasOwnProperty ( "approval_prompt" ) ) {
706
- approval_prompt = options . approval_prompt === true ? 'force' : 'auto' ;
707
- }
708
- }
709
701
710
702
var browserRef = window . cordova . InAppBrowser . open (
711
703
'https://accounts.google.com/o/oauth2/auth?client_id=' + clientId
712
704
+ '&redirect_uri=' + redirect_uri
713
705
+ '&scope=' + appScope . join ( " " )
714
706
+ '&approval_prompt=' + approval_prompt
715
707
+ '&response_type=token'
708
+ + '&prompt=' + prompt
709
+ + '&login_hint=' + login_hint
710
+
716
711
, '_blank'
712
+
717
713
, 'location=no,clearsessioncache=' + clear_session
718
714
+ ',clearcache=' + clear_cache
719
715
) ;
0 commit comments