@@ -1508,6 +1508,7 @@ def __init__(self, client_id, client_secret, scope,
1508
1508
auth_uri = GOOGLE_AUTH_URI ,
1509
1509
token_uri = GOOGLE_TOKEN_URI ,
1510
1510
revoke_uri = GOOGLE_REVOKE_URI ,
1511
+ login_hint = None ,
1511
1512
** kwargs ):
1512
1513
"""Constructor for OAuth2WebServerFlow.
1513
1514
@@ -1530,13 +1531,17 @@ def __init__(self, client_id, client_secret, scope,
1530
1531
defaults to Google's endpoints but any OAuth 2.0 provider can be used.
1531
1532
revoke_uri: string, URI for revoke endpoint. For convenience
1532
1533
defaults to Google's endpoints but any OAuth 2.0 provider can be used.
1534
+ login_hint: string, Either an email address or domain. Passing this hint
1535
+ will either pre-fill the email box on the sign-in form or select the
1536
+ proper multi-login session, thereby simplifying the login flow.
1533
1537
**kwargs: dict, The keyword arguments are all optional and required
1534
1538
parameters for the OAuth calls.
1535
1539
"""
1536
1540
self .client_id = client_id
1537
1541
self .client_secret = client_secret
1538
1542
self .scope = util .scopes_to_string (scope )
1539
1543
self .redirect_uri = redirect_uri
1544
+ self .login_hint = login_hint
1540
1545
self .user_agent = user_agent
1541
1546
self .auth_uri = auth_uri
1542
1547
self .token_uri = token_uri
@@ -1574,6 +1579,8 @@ def step1_get_authorize_url(self, redirect_uri=None):
1574
1579
'redirect_uri' : self .redirect_uri ,
1575
1580
'scope' : self .scope ,
1576
1581
}
1582
+ if self .login_hint is not None :
1583
+ query_params ['login_hint' ] = self .login_hint
1577
1584
query_params .update (self .params )
1578
1585
return _update_query_params (self .auth_uri , query_params )
1579
1586
@@ -1656,7 +1663,7 @@ def step2_exchange(self, code, http=None):
1656
1663
1657
1664
@util .positional (2 )
1658
1665
def flow_from_clientsecrets (filename , scope , redirect_uri = None ,
1659
- message = None , cache = None ):
1666
+ message = None , cache = None , login_hint = None ):
1660
1667
"""Create a Flow from a clientsecrets file.
1661
1668
1662
1669
Will create the right kind of Flow based on the contents of the clientsecrets
@@ -1674,6 +1681,9 @@ def flow_from_clientsecrets(filename, scope, redirect_uri=None,
1674
1681
provided then clientsecrets.InvalidClientSecretsError will be raised.
1675
1682
cache: An optional cache service client that implements get() and set()
1676
1683
methods. See clientsecrets.loadfile() for details.
1684
+ login_hint: string, Either an email address or domain. Passing this hint
1685
+ will either pre-fill the email box on the sign-in form or select the
1686
+ proper multi-login session, thereby simplifying the login flow.
1677
1687
1678
1688
Returns:
1679
1689
A Flow object.
@@ -1690,6 +1700,7 @@ def flow_from_clientsecrets(filename, scope, redirect_uri=None,
1690
1700
'redirect_uri' : redirect_uri ,
1691
1701
'auth_uri' : client_info ['auth_uri' ],
1692
1702
'token_uri' : client_info ['token_uri' ],
1703
+ 'login_hint' : login_hint ,
1693
1704
}
1694
1705
revoke_uri = client_info .get ('revoke_uri' )
1695
1706
if revoke_uri is not None :
0 commit comments