Error:invalid_client OAuth2 YouTube data API - javascript

I am using YouTubeAPI in Javascript with OAuth2.
I created a new project in google developers console,
I enabled YouTube Data API v3,
I set my OAuth Consent : link
I created a OAuth 2.0 client : link2
When I am using javascript to use this API (accordingly with youtube api-samples), I have this response :
That’s an error.
Error: invalid_client
Application: TESTAPPLICATION
You can email the developer of this application at: myemail#myemail.com
no registered origin
Is it comming from something i missed in my code or did i make a bad configuration in google developers console ?

Related

Google Picker API for Google Workspace users only

Hi, I want the users of our organization only to use google picker to select files from their google drive.
I followed this example to set up API key and oAuth client in the google developer console.
Here is the summary of what I did:
Enabled Google Picker API in Google API Console
Created API Key
Created OAuth client
Using Official Example google picker is working but it allows all Gmail users as well, I want to allow only those emails which belong to my domain.
I could not found anything related to this in official docs so I have the following questions:
Is it possible?
Is it possible to bypass the consent screen using service account impersonation(User Access Token generated on the server via impersonation)?
This is a high level explanation, but the idea is the following:
Using a server side script, you will generate a token for a user using a service account and impersonation.
On the client side, you will have to call that script on the server side and have the server return the token.
When initializing the picker, you will set the token to what you received from the server using the PickerBuilder.setOAuthToken() method.
That way you not only bypass the consent screen, but also make sure the drive picker presents the drive files of the user you authenticated with the service account.
If you are looking for a low level explanation, edit your question and post your architecture along with your code.

Verifying/whitelisting website for Google Calendar

I'm trying to make a portal where users can authenticate their Google credentials and then access their Google Calendar by creating and deleting events all via my website. However, I can't seem to find where on the Google Developers Console where to whitelist my site because of this following error:
{
"error": "idpiframe_initialization_failed",
"details": "Not a valid origin for the client: https://maxstechandmathsite.azurewebsites.net has not been whitelisted for client ID (my client ID).
Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID."
}
The JavaScript code I'm using is in reference to this Github page: https://github.com/gsuitedevs/browser-samples/blob/master/calendar/quickstart/index.html. Besides having to verify my site ownership, the issue may also be having an incorrect client ID or API key. For Google Calendar, I'm assuming you use the client ID and API key for the Google Calendar itself, but would I possibly have to use my Google Sign-In client ID for the OAuth 2.0 authorization? I tried that client ID, but no error message came up in the first place, unlike with the Google Calendar client ID, so I think I'm on the right track. I just can't find any Google docs on this error.
Turns out I was right. I did have to use my OAuth 2.0 client ID instead of the Google Calendar client ID generated for me when enabling the Calendar API. Not only that, but I had to use a previous API key I made on the Google Developers Console.

how to use oauth2.0 call youtube v3 api

I want to use youtube v3 api to do a side project like youtube, I read the YOUTUBE V3 API file if I want to have CRUD and upload features must use oauth2.0, currently Creating OAuth 2.0 credentials has been completed, then can also get the token smoothly.
But my problem is that the documentation does not see an example of using the oauth2.0 call api.
In the case of Playlists just see the instructions and incomplete url
Instructions:
"Call the playlists.list method to retrieve the currently authenticated user's playlists. In your request, set the mine parameter's value to true. Note that a request that uses the mine parameter must be authorized using OAuth 2.0"
URL:
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlists.list?part=snippet,contentDetails&mine=true
No examples of JSON or use oauth2.0 token call API, I would like to ask if you have used or. There are examples (API request & respond)
Thanks

Use Google Drive API from Javascript

I want to extend a project in a way that it can save files to Google Drive. To learn how this works I tried the Quick Start Example from the docs: https://developers.google.com/drive/v3/web/quickstart/js
Following the example I noticed that the example is creating an API key in the developer console. Following the same steps only returns a Client secret. I suspected this to be a naming problem and hoped that the two are the same.
Unfortunately, the example code does not work but loggs the following error:
{"error":{"errors":[{"domain":"usageLimits","reason":"keyInvalid","message":"Bad Request"}],"code":400,"message":"Bad Request"}}
In the request to:
https://content.googleapis.com/discovery/v1/apis/drive/v3/rest?pp=0&fields=kind%2Cname%2Cversion%2CrootUrl%2CservicePath%2Cresources%2Cparameters%2Cmethods%2CbatchPath%2Cid&key=[[my key]]
I checked that the right secret appears in the request url. Setting var API_KEY = '<YOUR_API_KEY>'; to an empty string is a workaround.
How can I debug this further? where do i get the right api key?
I run into this error recently. It is certain that Google Documentation is usually quite good, but in this case, the Google Drive API (https://developers.google.com/drive/api/v3/quickstart/js) it wasn't that clear. For this API in particular, you will require two credentials.
Under your project credentials section, you must create an OAuth 2.0 client for a web application and a API Key.
(Sorry for the Spanish in the screenshots)
Regarding the OAuth 2.0 client, not that I have restricted it to http://localhost
Concerning the API Key, note that I have restricted it to my Google Drive API
Then, in the index.html provided by the documentation, you can set your CLIENT_ID to the one obtained in the OAuth 2.0 client generation, and the API_KEY to the the one generated in the API Key process.
{"error":{"errors":[{"domain":"usageLimits","reason":"keyInvalid","message":"Bad Request"}],"code":400,"message":"Bad Request"}}
Means that the request you have made has not been properly authenticated.
API key is for accessing public data. Oauth2 client id and secret will be used to access private user data which file.list is. So i dont think this is a naming problem. Your code should be popping up requesting access of the user.

API error:191 in appmobi facebook integration HTML5 mobile web app

I am trying to integrate facebook in my web application where the user can sign in using the facebook id and password but above I can't sign in to the web app - I am frequently getting the following error:
API Error Code: 191 API
Error Description: The specified URL is not owned by the application
Error Message: Invalid redirect_uri: Given
URL is not allowed by the Application configuration.
And after we continue a facebook login page comes which directs us to the user's facebook account. Someone please suggest me how to do this?
I have tried the appmobifacebooktemplate and many samples
http://developers.facebook.com/docs/authentication/client-side/
http://thinkdiff.net/facebook/new-javascript-sdk-oauth-2-0-based-fbconnect-tutorial/
It sounds like the problem is that the URL that the application asks Facebook to redirect to is not sitting well with the new Facebook API. The sample Facebook application and web pages on the appMobi site are well over a year old. There is probably a bug with that.
A new Facebook integration API is due to be released by appMobi soon. Perhaps that could solve the problem?

Categories