Reputation: 188
I have created a CSE and need to programatically update the promotions. This is done in a backend system and user interaction in the authentication process is therefore not an option.
Updating the promotions can be done with their Custom Search API via HTTP. This process needs an authentication token.
Their documentation says that Custom Search only supports "ClientLogin" authentication. This has been deprecated by Google and it also involves CAPTCHAs so this is not an option. They also state that all authentication should be done through OAuth2 now.
I have already implemented OAuth2 without user interaction with Google Analytics API.
My problem is: I cannot find the scope value for Custom Search API to use with OAuth2. Any ideas?
Upvotes: 11
Views: 4044
Reputation: 35
I had this exact same problem with CSE promotions so I contacted Google support and got this response:
"Hi,
Greetings from Google for Work Support Team!
As i understand from your message, you are trying to use GSS features programmatically, i would like to update you that GSS supported only client login authentication to access search engine and its features programmatically, but client login is deprecated and it no longer works with GSS.
Oauth 2.0 is also currently not supported with GSS.
We already have a feature request #6043481 to provide support for Oauth 2.0 with GSS. However i don't have an ETA when it will be implemented.
Due to this reason, currently adding promotion programmatically is not possible. I would recommend you to use search engine control panel and respective features manually by opening GSS control panel in browser and update promotion from GSS control panel->Search Feature-> Promotions-> Add as per your requirement.
Please check the same from your end and let me know if you need any further assistance with this."
In short, we are hosed.
Upvotes: 1
Reputation: 63
Has anyone determined how to use OAuth 2.0 to add, edit, or delete CSE Promotions via API? This was easy under ClientLogin, which the Google docs still say to use.
After adding a scope for CSE on our acct., the result says "Returns metadata about the search performed, metadata about the custom search engine used for the search, and the search results." There's no mention of being about to work with Promotions.
-Ken
Upvotes: 1
Reputation: 31
Although https://www.googleapis.com/auth/cse is a valid API scope it unfortunately doesn't have any listed API operations for the token returned.
As the April 20, 2015 deadline approaches, which is the day they will stop supporting CLientLogin, I hope that a solution becomes available.
Upvotes: 2
Reputation: 183
For anyone who comes across this there is a google scope for custom search using oAuth2. Just keep in mind that you would have to re-obtain the tokens after you add the scope.
The scope for Google Custom Search is the following:
https://www.googleapis.com/auth/cse
Upvotes: 3
Reputation: 1638
If you look at Google OAuth Playground you will not find Custom Search as one of the available scopes. Unfortunately you only have access to the services (and their various scopes) listed there.
Upvotes: 1
Reputation: 98
Any update ? Also trying to implement custom search via OAuth2 but no clue on Google Developers document ... I guess we just can't.
The PHP lib I use return a invalid scope :
Some requested scopes were invalid. {invalid=[https://www.googleapis.com/auth/customsearch]}
Upvotes: 1
Reputation: 421
I believe you can use the API Key function (which is not an OAuth 2 key) to access CSE apis.
here's the documentation. https://developers.google.com/custom-search/v1/using_rest?hl=en
Is there some reason the API key doesn't work and you need OAuth2?
Upvotes: 3