0
votes

Lately, I have been working on a project designed to create a google form, and have been able to use the Google Developers OAuth 2.0 Playground (after putting in my scopes, setting the OAuth flow to client-side, using my Client ID, et cetera), as well as the Forms API reference, to successfully make API calls for my application. However, I was wondering how I would go about fully making an API call to Google Forms with JavaScript? Everything I have tried so far has been unsuccessful. I have a working API key and Client ID (with the correct Authorized JavaScript origins, set to my VSCode Live Preview server for testing), and because I have been able to use them on the OAuth Playground, I know that they work.

I have been trying to use Google's JavaScript API client, because that's what the Forms API reference recommends, and their authentication sample (after I put in my Google Forms enabled API Key, Client ID and discovery document) gave me the error below.

"You have created a new client application that uses libraries for user authentication or authorization that will soon be deprecated. New clients must use the new libraries instead; existing clients must also migrate before these libraries are deprecated. See the Migration Guide for more information."

The migration guide wants everyone on Google Identity, and after looking through those docs I have realized that I am in way over my head.

But the Google Identity library references the JavaScript Client library! So I really don't know what is going on. I would assume that the authSample.html is just outdated? But I haven't really found any other good references in that repo for a complete "sign-in and use an api" process.

Since I was able to call the API through the OAuth 2.0 Playground, theoretically I could just make my application copy a request body, open the playground, and have the user paste the generated form code into the request body and send the request, which is the only way I have been able to get it to work, but obviously that's a last resort.

Any help at all is appreciated! I don't really have much experience with calling APIs. Thanks!