I've been struggling quite a bit to solve the this issue. Basically, I'm just trying to connect to my youtube channel and get a list of future and past live broadcasts from my PHP based application. I was able to create a service account on the api console and it seems to be working fine now (as I've had some oauth authentication errors before) but now, I'm receiving this error in my error log:
Uncaught exception 'Google_Service_Exception' with message 'Error calling GET
https://www.googleapis.com/youtube/v3/liveBroadcasts?part=id%2Csnippet&mine=true:
(403) The user is not enabled for live streaming.' in etc...
My youtube account is associated with my personal #gmail.com account. I'm assuming that somehow I have to add the #developer.gserviceaccount.com to my youtube channel but even though I've tried to find any instructions for this, I was not able to find. I have live streaming enabled on my personal gmail account and also have some test events there.
Would appreciate and help in this matter please. Thanks!
Not sure if this will help, but in my case it turned out to be that the account somehow had 2 accounts:
a page with a strange page-id#pages.plusgoogle.com and
a normal Google email account user#gmail.com).
On top of that, I had issues with not renewing the access token: e.g sending an old access token.
Make sure you try the 2 sub accounts; one must have the videos under it. If you choose the wrong one, then you get that error above.
Related
Hello to all
I am new in Amazon Alexa, I have a work to Alexa Skill account linking using PHP with oauth 2.0.
I have successfully configured all and also get code for Auth Code Grant but when I run my code in Chrome Browser it is generating Account linking Failed issue but when I run same URL in Firefox it generates Amazon linking failed with ERROR=missing-state.
Please help me to resolve my issue, any help would be highly appreciated.
Implementing Account Linking is tricky at times. The thing is at some point what happens between Alexa and the OAuth2 server is transparent for the Skill (Lambda), for example the process of refreshing a token among others, that is why I suggest you take a look at the references cited below.
Also because of the error shown, it seems that the parameter code is missing in one of the URLs exchanged back and forth between either the Alexa web console or Alexa mobile app and the OAuth2 server. Please verify it is always the same and is always present in the URLs. Implementing a proxy for sure will help on debugging this issue.
I would suggest you take a look at these great sources:
Debugging Account Linking
Using API Gateway to Debug Account Linking issues
I hope this helps somehow.
Cheers
I've been crawling the internet all morning trying to figure this out. I'm trying to get access to a Adwords test account through the API but I keep receiving "An error has occurred: { "error" : "invalid_grant" }". I've seen this is quite a common problem so perhaps if I outline what I've done step by step someone can correct me. Hopefully!
Created a Google adwords account and set up a campaign.
Created a MCC account. Added Google adwords account and applied for API access (pending). Noted API key, client id for auth.ini.
Created a test MCC account and added Google adwords account. Noted client id for auth.ini.
Using the Google account of both MCC accounts went into the API console and created a new installed application app. Noted all keys/tokens.
Downloaded the PHP code examples and libs. Ran get GetRefreshToken.php, granted accesses to app(s) and noted refresh token for auth.ini
Set up auth.ini populating developerToken, userAgent, clientCustomerId, client_id, client_secret and refresh_token.
Now I've tried using BOTH sets of tokens and ids from the test MCC account API console and the live MCC account API console. Both give me the same error. I've tried regenerating all tokens several times.
Gave up and came crawling to StackOverFlow.
Is the invalid_grant message related to Auth or my developerToken token not being activated yet (sure it said I could use my test account though) or because I haven't set up any of the billing?
In my case the problem was at step 5 in your list; I had copied the authorization code from my browser after granting access, rather than the refresh token generated by GetRefreshToken.php after I pasted the authorization code there.
I had the same situation for a long time.
But solution was very simple.
The code getting after authorizing the Google is not your refresh token.Its is only an access token(I guess.)
You have to add this code to GetAccessToken's $code variable function in getrefreshtoken.php file and it will return the actual Refresh token.
This solved my issue.
It is very important to note that the SDK is designed to be used through PHP-Cli. So please don't use it via browser. If you still run it by commenting out return line you'll get into further problems to comment that on each file :)
After many many hours searching I am still unable to figure out why I am receiving this error. It worked for a month and without touching any code, stopped working last night. The web app has been registered and Google+ api is turned on.
Fatal error: Uncaught exception 'Google_ServiceException' with message 'Error calling GET https://www.googleapis.com/oauth2/v2/userinfo?key=MYKEY: (403) Access Not Configured. Please use Google Developers Console to activate the API for your project.'
I enabled Google+ Domain API just to see if it did anything. It allowed me to login 1 time and then continued to fail after that.
The developer key should be OK to pass every time as long as it matches the project that has been used for sign in (e.g. the client ID and the key come from the same developers.google.com/console project).
There was a problem yesterday with the userinfo endpoint that caused 403 for a number of users - that has now been resolved, but my guess is you were hitting that unfortunately!
So after further research and testing, I think I have the solution.
As mentioned by Jason OOO, $client->setDeveloperKey($key); was causing the problem.
As it turns out, Google PHP library needs $client->setDeveloperKey($key); passed the first time for validation, but causes an error if passed again after already being validated.
So, to fix this problem, check to see if user is already logged in and if they are do not pass $client->setDeveloperKey($key);
I am using the PHP version of the Google Glass Developer Kit. Setup everything per the sample code instructions. API/credentials are all fine, account billing is setup, have added the Mirror API to the project, but after I permission the application, I get the following Error:
An error ocurred: Error calling POST
https://www.googleapis.com/mirror/v1/timeline?key=xxxxxx
(403) Access Not Configured.
Please use Google Developers Console to activate the API for your project.
I have added the Mirror API and have Billing active and setup so have no idea why i am getting the error message. Testing the app via the Glass Explorer works just fine.
Google APIs have been known to misbehave when you provide both OAuth2 credentials and an API Key. Also since you have to use OAuth2 to access the Mirror API, the key=xxxxx isn't necessary anyway.
If you are using the Google APIs Client Library for PHP you can simply remove the following line from your code:
$client->setDeveloperKey($key);
Not entirely sure if this causes your issue, but I have come across similar issues in other Google APIs.
In Google API console for your project (https://code.google.com/apis/console/)
Make sure that your "Public API access" or "Key for server application" has allowed the IP address of your server.
Also make sure you have the proper "Redirect URIs", if you get refused, look at your php logs, I had this:
PHP Fatal error: Uncaught exception 'Google_ServiceException' with message 'Error calling GET https://www.googleapis.com/mirror/v1/timeline?maxResults=3&key=: (403) Access Not Configured. Please use Google Developers Console to activate the API for your project.'
use your $base_url + /oauth2callback.php to find out what the correct Redirect URI is.
I managed to solve the issue by adding the IP address and REDIRECT URIs and it runs both on my local machine and on the server. (same code, same key)
PS: I want to thank Scarygami, disabling the $client->setDeveloperKey($key); helped me find the solution.
I am using Adwords API from last 3 months and all of a sudden today it is coming up with error message as follows:
Uncaught exception 'AuthTokenException' with message 'Failed to get authToken. Reason: BadAuthentication'
I am using google adwords V201101 php library with auth.ini containing all user details and settings.ini with https://adwords.google.com not sandbox environment. Can anyone help me with this please???
Thanks,
Murali.
you may requesting authToken from ClientLogin service too many times, that is way you get 'CaptchaRequired'.
Request authToken just for the first time, and then cache it for subsequent requests.
Check this out http://goo.gl/TOX6N
I recently had this problem trying to connect to Google DFP. I copied perfectly working code from my localhost after development and ran it on my remote cloud server. I then received the
Failed to get authToken
message. The reason was that google was blocking the attempted login as a security measure because it was a new location. I had to log into the google account (from the web) with those credentials in order to see the message and confirm the added login location. Everything worked fine after that authorization.
I've stumbled across this question and thought that this info may help someone else.
BadAuthentication means your username/password is incorrect. May be someone changed the account password, may be auth.ini got modified by mistake.
See detailed error codes here: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#Errors
Cheers,
Anash
I started getting this error after somebody in my organization updated the password for the account my app was using to log in. The best way to avoid this happening again is to use OAuth2.
It's as easy as going to the Google API console and creating a Client ID for Installed Applications (under API access) for your project. You then use the Client ID and Client Secret in your Adwords API auth.ini file.
Next you run the examples/AdWords/Auth/GetRefreshToken.php script which will have you grant your app access to your Adwords account. You'll end up with a Refresh Token which you need to add to your auth.ini.
The ClientLogin (username and password) method of authentication is being deprecated in favour of the above so best to migrate ASAP.