Can't select Youtube manager account when creating refresh token - youtube-api

We are currently trying to setup a youtube refresh token for a youtube channel of which we only have a manager account with admin rights.
Sadly this does not seem to work currently. Are we correct in the assumption that currently only the owner of a youtube channel is able to request a refresh token?
Or is this something we can also somehow request as only a channel manager? In case that is possible what do we need to do to make it work from a manger account?
We already asked this question to the Adwords API Team but they could only send us here, you can see the thread here: https://groups.google.com/u/1/g/adwords-api/c/iTOfy7-Sfm8
Cheers,
InnoGames Dev Marketing Team
To create a new refresh token we are using a URL like this: "
https://oauth2.googleapis.com/token?code=#CODE#&client_id=#CLIENT_ID#&client_secret=#CLIENT_SECRET#&grant_type=authorization_code "
With the scope "https://www.googleapis.com/auth/youtube" to generate a new token.
The way we are using it currently will ask us to select a google account in the typical google login form. But there we can only select our manager account but not the youtube channel if want to generate the token for.

Related

How to authenticate Tweepy Application to tweet via discord

I am currently developing a discord bot that can post tweets and more. The whole code is basically done all I need to do now is make the user authenticate the app so the bot can post tweets. I searched everywhere and I don't have any idea on how to do it. My goal is to have multiple users in a discord chat use the bot at the same time
From what I understand, you want your bot to have control multiple user's API ?
If so,
Have the user inputs their credentials using a command, (best would be by DM, like ?api XXXXXX)
store this credentials into a database and have your API Caller lookup for a specific API credentials within your DB.

How do I use the YouTube Data API to upload video to secondary channel on personal account

I have looked around Stack Overflow and seen a few posts about this but none of the solutions help.
I have a Google account which I use in YouTube. I have created a second channel on that YouTube account so that I can upload videos with a specific theme to separate them from the main videos.
Trying to use the Google API to upload the videos so that I can run it via a Python script, I keep hitting brick walls with Google who is looking for app verification, privacy policies and web page links - none of which I have.
This application is a Python script that's not available to the public and doesn't gather any public information. All I am trying to do is upload videos to my own personal YouTube account.
So I'm beginning to think it is something else I should be using rather than the API (the uploading web page isn't suitable for use in a script).
My two question are:
Can I use the YouTube API to upload a video directly to the second channel on my personal YouTube account?
Is there another simpler mechanism I should be using to upload videos via a script to my personal YouTube account? The reason I have to do it via script is that the device is unattended.
Thanks,
David
You have to acknowledge that each and every app (this to be understood in a broad sense that includes even a small script like this one from Google upload_video.py) must be verified and approved by Google prior to be able to make videos publicly available via the YouTube site.
Answer to question no. 1: yes, that is perfectly possible.
As part of the OAuth 2.0 authentication/authorization flow, you will be presented, within the browser, with the option of selecting to which account your app is to be given access rights.
You may well exercise this behavior, prior to making use of your script, with the help of Google Developers OAuth 2.0 Playground.
Upon a successful OAuth flow, you may verify (and also revoke) the permissions granted by your account on the account's permissions page.
Answer to question no. 2: no, there's no way to upload programmatically videos on YouTube that's in compliance with YouTube's DTOS, other than using the Videos.insert API endpoint.
Addendum
Since by now you have at least two credentials sets, it may be of need to know to which of your YouTube channels a given credentials object is associated.
If using the Google APIs Client Library for Python, you may easily obtain from the API the channel ID to which a given credentials object CREDENTIALS is associated by issuing a call to the Channels.list API endpoint, passing to it the parameter mine as mine=true:
from googleapiclient.discovery import build
youtube = build(
'youtube', 'v3',
credentials = CREDENTIALS)
response = youtube.channels().list(
mine = 'true',
part = 'id',
fields = 'items(id)',
maxResults = 1
).execute()
channel_id = response['items'][0]['id']
Note that the code above uses the fields request parameter for to obtain from the Channels.list endpoint only the channel's ID info (it is always good to ask from the API only the info that is of actual use).
A caveat using the above procedure is the following: if a given CREDENTIALS instance has its scopes containing only:
https://www.googleapis.com/auth/youtube.upload,
then the API will respond with an error of type insufficientPermissions and of message Request had insufficient authentication scopes.
For to invoke successfully the Channels.list it would be sufficient that the scopes attached to CREDENTIALS to include either of the one below:
https://www.googleapis.com/auth/youtube.readonly,
https://www.googleapis.com/auth/youtube.

Google Assistant - Sign in to Strava

Apologies if this is a newbie question but I'm hoping someone can offer some advice.
I am fulfilling my Google Assistant intents via an Express app. I would like for users of my action to be able to get and modify data from their Strava account. Strava supports Google Authentication and I wondered if I could use node libraries such as Passport (https://www.npmjs.com/package/passport-strava-oauth2) to allow users to sign in to their strava account so that my action can make calls for their data?
I have a welcome intent that gets some Google profile data so wondering if I can pass through some details from this response?
googleApp.intent('Default Welcome Intent', (conv) => {
conv.ask(new Permission({
context: 'Hi, can I get your details from your Google account?',
permissions: 'NAME'
}));
});
Yes, but probably not in the way you're looking at.
The Permission helper requests access to specific types of information - name and location. You're looking to establish more of an identity relationship (using their email address or Google account).
You can do this using Account Linking.
If you're sure you're using Google Sign In on the Strava side then things are even easier and you can take advantage of Google Sign In for Assistant. With this, once they sign in, your Action will get an Identity Token which you can use to get information including their Google ID and the email address associated with the signed-in Google account. They only need to sign-in once - afterwards, you'll be given an Identity Token whenever they connect.
If your Strava project and your Action are both using the same Google Cloud Project, things get even easier for your users. Once they have signed in on either client, they're signed in on the other one. So you'll know who they are immediately through the Identity Token.

SalesforceIQ/RelateIQ API: how do I create a contact for external users (OAuth?)

I'm building an app that shows users people they might be interested in talking to. If a user says he's interested in a person I show them, I want my app to create this person as a contact in my user's SalesforceIQ.
How do I do this? I see from the API documentation https://api.salesforceiq.com/#/ruby#documentation_contacts_create-a-contact that I can create a contact if I know my user's username and password, but of course I don't want my users to give me this information. Is there some way for the user to OAuth or whatnot by clicking a button that authorizes me to add things to their SalesforceIQ?
The SalesforceIQ API uses HTTP Basic authentication and does not currently support OAuth according to their documentation.
For a SalesforceIQ user to grant API access to your app to create contacts and for other privileges, the SalesforceIQ admin creates an API Key and API Secret for your app which is then used for the HTTP Basic authentication username and password. This way no user needs to provide your app with their credentials. This is configured in the SalesforceIQ admin UI under Settings > Integrations > Create New Custom Integration.
For the admin to provide these credentials to your app, you can have a UI where the SalesforceIQ admin enters this for your app to store and use with the API for their account.
This is described in the following places, briefly in the API Reference and in detail in a Help Desk article with screenshots of what the SalesforceIQ admin needs to do:
API Reference: Requesting Access
API Reference: Security and Authentication
Help Article: Set up API access

Sending hidden request to oAuth

I wanted to show GA data to each one client on my website. Each one of them has create own GA profile, I store in database profile_id.
Credentials to GA data are my personal, the same for all profiles, all profiles are in my account. For settings oAuth I used this article: http://www.sitepoint.com/google-analytics-api/.
Clients don´t know my credentials and I don´t want to create them permissions to see the stats. I need the only login into my website (login data are URL|password). After they logged into the client section, I select from database their profile ID and need to show them their stats (without showing Google login dialog). I´d like to pass my credentials directly somewhere in the PHP script.
So, question is:
Is possible to show GA data using oAuth directly without showing Google login dialog? To login in app´s backend?
Thanks.
Yes, if you do the OAuth 2 flow correctly, you will get an access token. Once you have that access token you can use it to query any Google Analytics view (previously called profile) to which you have access.
To do the query, simply append the access token as a query parameter when making your request to the Core Reporting API. This reference shows how to add the access token to the request:
https://developers.google.com/analytics/devguides/reporting/core/v3/reference#q_summary
If you don't want to build the charting yourself, you should also look into using the Embed API. You can use the Embed API's serverAuth option when authorizing to avoid having to have your users log in with their Google accounts:
https://developers.google.com/analytics/devguides/reporting/embed/v1/component-reference#auth

Resources