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

initTokenClient never calls call back. #926

Open
ulao opened this issue Aug 22, 2023 · 4 comments
Open

initTokenClient never calls call back. #926

ulao opened this issue Aug 22, 2023 · 4 comments

Comments

@ulao
Copy link

ulao commented Aug 22, 2023

I'm trying to use this new auth method and nothing seems to work.

Summary
no callback is fired during auth.

Browser(s)/Version(s)
Chrome latest

Expected Behavior
a call back

Actual Behavior
no call back

Steps to Reproduce
This is my code

client = google.accounts.oauth2.initTokenClient({
client_id: CLIENT_ID,
scope: 'https://www.googleapis.com/auth/spreadsheets.readonly',
callback: (tokenResponse) => {
access_token = tokenResponse.access_token;
gapi.client.setApiKey(API_KEY);
gapi.load('client', test() );

		  },
	})

I can alert the function google.accounts.oauth2.initTokenClient and it has loaded. but nothing is running in the call back function

@rossMac96
Copy link

@ulao did you ever find a workaround for this? having the same issue. can get the sign in popup to work just fine, but once it closes, the callback is not invoked.

@rossMac96
Copy link

For people struggling with this issue, it seems that Google wants your site to either be http, or https with a real (not self signed) certificate. I can't find any documentation that points to this requirement, but I tried changing my https (self signed cert) over to http, and the callback is now firing as expected.

@LiubomyrB
Copy link

In my case, it doesn't fire callback because of Header set Cross-Origin-Opener-Policy "same-origin".

@dkudumovic1
Copy link

What worked for me was adding an error_callback. It helped me to understand why my callback wasn't being called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants