Issue with YouTube implementation using Google API - youtube

Hi iam trying to access YouTube data API by OAuth 2.0 authentication.I obtained access token and refresh token successfully.Now i am trying to upload video by using the following link .
https://developers.google.com/youtube/v3/code_samples/java#upload_a_video
I am unable to create credentials.pls suggest me the what is the userid i need to pass and from where i can get the userid to authorize method.
Credential credential = Auth.authorize(scopes, "uploadvideo");

Related

Youtube Api LiveChatMessages: insert

I'm trying to create a bot that moderates youtube channels, but your api doesn't allow you to use the apiKey to use this api resource.
What alternatives do I have? Is there any other solution to use this api resource without doing an oauth2? or is there any way to do oauth2 from the api without going through a browser to get a valid token and use the api?
Thanks
I'm trying to create a bot that moderates youtube channels, but your api doesn't allow you to use the apiKey to use this api resource.
Api keys are only useable for public data not private user data
Is there any other solution to use this api resource without doing an oauth2?
You need to use Oauth2 and request authorization of the owner of the data.
is there any way to do oauth2 from the api without going through a browser to get a valid token and use the api?
No the user will always need to open the consent screen in a browser window. this will return to you the access token you need to access private user data.

how to automatically generate access_token form OAuth for API?

I am using Spotify's API to fetch data and its using OAuth so I need to generate a new access_token every hour to use the API.... is there a way to generate access-token automatically ?

Which youtube credentials should I use?

I just want to fetch some data from the playlist, to make it work. Which Credentials do I need to use?
API keys
OAuth 2.0 client ID
If you are just getting playlist, searching YouTube videos via keyword or listing videos you can use API keys, but if you have to upload videos or access private user data you have to use OAuth 2.0 client ID.
OAuth 2.0: Your application must send an OAuth 2.0 token with any request that accesses private user data. Your application sends a client ID and, possibly, a client secret to obtain a token. You can generate OAuth 2.0 credentials for web applications, service accounts, or installed applications.
See the Creating OAuth 2.0 credentials section for more information.
API keys: A request that does not provide an OAuth 2.0 token must send an API key. The key identifies your project and provides API access, quota, and reports.
See the Creating API Keys section for information about creating an API key.
Hope this helps.

Retrieving a youtube playlist without asking the user for login

is it possible to retrieve a public youtube playlist with the google-api-objectivec-client without asking the user to login in order to perform the OAuth 2.0 authentication?
I'm working on an app which should retrieve a playlist from youtube and play related videos, but I cannot and don't want to ask the user to login.
In the examples of google-api-objectivec-client (https://code.google.com/p/google-api-objectivec-client/source/browse/#svn%2Ftrunk%2FExamples%2FYouTubeSample) I'm not able to achieve it without OAuth 2.0 authentication.
Thanks,
DAN
Yes, you don't need OAuth2 login for that. You can simply do it by setting your API key instead.
It's a playlistItems->list request.
Here's demonstration in api explorer: https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlistItems.list?part=snippet&playlistId=PLjFEz-E0UPUxw3lFpnfV1dDA7OE7YIFRj&_h=2&
Instead of setting the authorizer of the service to OAuth2 login like in
youtubeservice.authorizer = [GTMOAuth2ViewControllerTouch
authForGoogleFromKeychain.....
set it's API key to your API key from cloud console in Public API access.
youtubeService.APIKey = xxxxxx

Salesforce webserver Oauth 2.0 integration

I am developing a google app engine - java project where I want to integrate Salesforce APIs.
I want to authorize user with Oauth 2.0 and want to retrieve contacts of the authorized user.
Salesforce API returns code in response of the first request and then again I request for the access token from the code.
With the access token when I call any of the service API it gives me following error
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
I found the issue.
In configurations Administration Profile was missing to be connected with Apps whose client ID and secret I was using.
you are not getting valid access token.
generate the proper url to get the access token
https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_at_Salesforce.com
For more proper information, you can have a look of this

Resources