mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #14649 from clementdenis/master
[gapi.auth2] Fix prompt param type in GoogleAuth.signIn and similar
This commit is contained in:
@@ -19,6 +19,22 @@ function test_getAuthInstance(){
|
||||
var auth = gapi.auth2.getAuthInstance();
|
||||
}
|
||||
|
||||
function test_signIn(){
|
||||
gapi.auth2.getAuthInstance().signIn({
|
||||
scope: 'email profile',
|
||||
prompt: 'content'
|
||||
});
|
||||
}
|
||||
|
||||
function test_signInOptionsBuild(){
|
||||
var options = new gapi.auth2.SigninOptionsBuilder();
|
||||
options.setAppPackageName('com.example.app');
|
||||
options.setFetchBasicProfile(true);
|
||||
options.setPrompt('select_account');
|
||||
options.setScope('profile').setScope('email');
|
||||
gapi.auth2.getAuthInstance().signIn(options);
|
||||
}
|
||||
|
||||
function test_getAuthResponse(){
|
||||
var user = gapi.auth2.getAuthInstance().currentUser.get();
|
||||
var authResponse = user.getAuthResponse();
|
||||
|
||||
Vendored
+32
-25
@@ -31,12 +31,7 @@ declare namespace gapi.auth2 {
|
||||
/**
|
||||
* Signs in the user using the specified options.
|
||||
*/
|
||||
signIn(options?: {
|
||||
app_package_name?: string;
|
||||
fetch_basic_profile?: boolean;
|
||||
prompt?: boolean;
|
||||
scope?: string;
|
||||
}, optionBuilder?: SigninOptionsBuilder): any;
|
||||
signIn(options?: SigninOptions | SigninOptionsBuilder): any;
|
||||
|
||||
/**
|
||||
* Signs out all accounts from the application.
|
||||
@@ -59,12 +54,8 @@ declare namespace gapi.auth2 {
|
||||
/**
|
||||
* Attaches the sign-in flow to the specified container's click handler.
|
||||
*/
|
||||
attachClickHandler(container: any, options: {
|
||||
app_package_name?: string;
|
||||
fetch_basic_profile?: boolean;
|
||||
prompt?: boolean;
|
||||
scope?: string;
|
||||
}, onsuccess: (googleUser: GoogleUser) => any, onfailure: (reason: string) => any): any;
|
||||
attachClickHandler(container: any, options: SigninOptions,
|
||||
onsuccess: (googleUser: GoogleUser) => any, onfailure: (reason: string) => any): any;
|
||||
}
|
||||
|
||||
export interface IsSignedIn{
|
||||
@@ -93,6 +84,32 @@ declare namespace gapi.auth2 {
|
||||
listen(listener: (user: GoogleUser) => any): void;
|
||||
}
|
||||
|
||||
export interface SigninOptions {
|
||||
/**
|
||||
* The package name of the Android app to install over the air.
|
||||
* See Android app installs from your web site:
|
||||
* https://developers.google.com/identity/sign-in/web/android-app-installs
|
||||
*/
|
||||
app_package_name?: string;
|
||||
/**
|
||||
* Fetch users' basic profile information when they sign in.
|
||||
* Adds 'profile', 'email' and 'openid' to the requested scopes.
|
||||
* True if unspecified.
|
||||
*/
|
||||
fetch_basic_profile?: boolean;
|
||||
/**
|
||||
* Specifies whether to prompt the user for re-authentication.
|
||||
* See OpenID Connect Request Parameters:
|
||||
* https://openid.net/specs/openid-connect-basic-1_0.html#RequestParameters
|
||||
*/
|
||||
prompt?: string;
|
||||
/**
|
||||
* The scopes to request, as a space-delimited string.
|
||||
* Optional if fetch_basic_profile is not set to false.
|
||||
*/
|
||||
scope?: string;
|
||||
}
|
||||
|
||||
export class SigninOptionsBuilder {
|
||||
setAppPackageName(name: string): any;
|
||||
setFetchBasicProfile(fetch: boolean): any;
|
||||
@@ -164,22 +181,12 @@ declare namespace gapi.auth2 {
|
||||
* When you use GoogleUser.signIn(), the sign-in flow skips the account chooser step.
|
||||
* See GoogleAuth.signIn().
|
||||
*/
|
||||
signIn(options?: {
|
||||
app_package_name?: string;
|
||||
fetch_basic_profile?: boolean;
|
||||
prompt?: boolean;
|
||||
scope?: string;
|
||||
}, optionBuilder?: SigninOptionsBuilder): any;
|
||||
signIn(options?: SigninOptions | SigninOptionsBuilder): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* See GoogleUser.signIn()
|
||||
*/
|
||||
grant(options?: {
|
||||
app_package_name?: string;
|
||||
fetch_basic_profile?: boolean;
|
||||
prompt?: boolean;
|
||||
scope?: string;
|
||||
}, optionBuilder?: SigninOptionsBuilder): any;
|
||||
grant(options?: SigninOptions | SigninOptionsBuilder): any;
|
||||
|
||||
/**
|
||||
* Get permission from the user to access the specified scopes offline.
|
||||
|
||||
Reference in New Issue
Block a user