Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Google Picker and Google Sign In together #391

Description

@indapublic

Hello.

Tried to implement google picker for my react app. First, I'm loading script and initialising google api

loadScript('//apis.google.com/js/api.js', () => {
	window.gapi.load('picker', () => {
	})
	window.gapi.load(
		'client:auth2',
		() => {
			window.gapi.auth.authorize(
				{
					client_id: googlePickerCredentials.clientId,
					scope: googlePickerCredentials.scope,
					immediate: true
				},
				authResult => {
					console.warn(authResult)
				}
			)
		},
		10
	)
})

First: It's working like a charm if user already logged in google. If user not logged, I see some strange requests.

screen shot 2018-02-15 at 14 09 11

Why?

Second: I need to sign in user if user not logged, so I'm using code from your authSample.

gapi.auth2.getAuthInstance().signIn();

It's weird, but gapi.auth2.getAuthInstance() returns always null

I found signIn function inside window.gapi.auth, but when I'm tried to run it

window.gapi.auth.signIn({
	client_id: googlePickerCredentials.clientId,
	cookiepolicy: 'single_host_origin',
	callback: result => {
		console.warn(result)
	}
})

I receive error in console

Missing required parameter 'client_id'

Tried to use code from sample again

gapi.client.init({
    apiKey: googlePickerCredentials.developerKey,
    clientId: googlePickerCredentials.clientId,
    scope: googlePickerCredentials.scope
}).then(function () {
	console.warn('init finish');
});

but it not helps. btw, I never passed inside then section in that case

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions