Unauthorized WebHook callback channel Google push notifications - google-drive-api

I am trying to monitor my files in Google Drive.
By getting notifications to the delivery channel.
I've tried everything and tried hundreds of times but every time he tells me:
`
I am using Postman.
Post https://www.googleapis.com/drive/v2/changes/watch
Body:
{"id": "01234567-89ab-cdef-012345***789ab",
"kind":"drive#startPageToken",
"type": "webhook",
"address": "https://nwafith.com/api/notifications"
}
Response
{
"error": {
"errors": [
{
"domain": "global",
"reason": "push.webhookUrlUnauthorized",
"message": "Unauthorized WebHook callback channel: https://www.nwafith.com/api/notifications"
}
],
"code": 401,
"message": "Unauthorized WebHook callback channel: https://www.nwafith.com/api/notifications"
}
}
In the Domain verification
I added:
www.nwafith.com
nwafith.com
Everything looks right but I don’t know exactly where the problem is.
I hope for help

Unauthorized WebHook callback channel:
Means that you have not properly authorized your domain in Google developer console.
Solution:
Go to the Google Developers Console
Select your project
Under 'APIS & AUTH' select 'Push'
Click 'Add domains'
Enter the needed domains (Only the domain is needed: https://www.nwafith.com)
Click the 'Add domains' button
After that it should work.

Related

Unable to access purchases.subscriptions API from developer console

I create IN app purchase for my product and I link google console application with androidpublisher consent
I am trying to call below API but its always fail
API to call :- https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/acknowledge?authuser=3
Error :-
{
"error": {
"code": 403,
"message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
"errors": [
{
"message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
"domain": "androidpublisher",
"reason": "projectNotLinked"
}
]
}
}

Where to view watson assistant error logs

A webhook call fails, how do I see the detailed logs?
The testing webhooks page describes that the errors are put in output.webhook_error.<result_variable>. For example if your result variable is webhook_result_1 then the output is in output.webhook_error.webhook_result_1.
As described in the documentation, if an error happens then in the "Assistant responds" section of the dialog node editor, the "If assistant recognizes" anything_else should be used, so you can put in there The callout generated this error: <? output.webhook_error.webhook_result_1 ?>..
This will show more information. For example if I configure an API to throw an Error, I will get back:
The callout generated this error: {"response_code":400,"message":"Webhook call was not successful. Response code is [400].","response_body":{"code":"cff11d18150e8018d5e304ac3fc35c94","error":"There was an error processing your request."},"content_type":"application/json"}.
If this error happens when the Bot is being used live, then in the logs the webhook response body will be captured. If you use the Try It Out panel in the UI then the logs are not captured.
In the Assistant UI for the Skill in the Analytics tab the conversation is shown. In the "User conversations" part of the UI the text of the conversation is captured, but you will only see the webhooks error if you add output as described above.
The API can be used to fetch logs for a workspace or skill which include the webhook error details. See List Log Events in a Workspace. If you are using a Skill then you can find out the URL to use from the Assistant UI. On the Skills list page, on the particular skill click the ... menu and select View API Details. The Legacy v1 workspace URL: shows the workspace ID to use.
For example if the Legacy v1 workspace URL: is https://gateway.watsonplatform.net/assistant/api/v1/workspaces/ce13f844-c3a7-4f36-97c6-a0ac704024a6/message the URL to use to fetch logs is https://gateway.watsonplatform.net/assistant/api/v1/workspaces/ce13f844-c3a7-4f36-97c6-a0ac704024a6/logs?version=2020-04-01
In the workspace log there will be the details of the user conversation where a webhook error happened in webhook_error:
"output": {
"generic": [
{
"response_type": "text",
"text": ""
},
{
"response_type": "text",
"text": "The callout generated this error: {\"response_code\":400,\"message\":\"Webhook call was not successful. Response code is [400].\",\"response_body\":{\"code\":\"cff11d18150e8018d5e304ac3fc35c94\",\"error\":\"There was an error processing your request.\"},\"content_type\":\"application/json\"}."
},
{
"response_type": "text",
"text": "Customer email is <? context.webhook_result_1.message ?>."
}
],
"text": [
"",
"The callout generated this error: {\"response_code\":400,\"message\":\"Webhook call was not successful. Response code is [400].\",\"response_body\":{\"code\":\"cff11d18150e8018d5e304ac3fc35c94\",\"error\":\"There was an error processing your request.\"},\"content_type\":\"application/json\"}.",
"Customer email is <? context.webhook_result_1.message ?>."
],
"nodes_visited": [
"slot_2_1520179906877",
"handler_3_1520179906877",
"node_1_1520179877410",
"node_9_1530805081298",
"response_5_1604940050659",
"node_7_1520180645829"
],
"webhook_error": {
"webhook_result_1": {
"response_code": 400,
"message": "Webhook call was not successful. Response code is [400].",
"response_body": {
"code": "cff11d18150e8018d5e304ac3fc35c94",
"error": "There was an error processing your request."
},
"content_type": "application/json"
}
},
"nodes_visited_details": [

Cannot get analytics for google url shortener on some of my links

I've got several links by google shortener and I am unable to access the analytics for one of them.
When I click on the first two analytics links it shows a 200 http status and the analytics show but with the last one there's a 500 error in my firefox console and the message Short URL goo.gl/6PL9Fx not found appears in a little message box.
Same thing with the Google URL Shortener api reference. Whenever I try this api it gives me this as a response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Backend Error"
}
],
"code": 500,
"message": "Backend Error"
}
}
These are my links:
goo.gl/SBGshX
goo.gl/ExkDyv
goo.gl/6PL9Fx
I actually have more links than just these and there's another broken one but I didn't want to overload the question.

Why are attempts to view revisions with the Google Drive API returning a 500?

I've been working with the Google Drive API for a bit, accessing the list of revisions for two sheets as part of a job with service.revisions().list(fileId=FILE_ID).execute(). Everything was fine until earlier this morning, when one of the requests (but not the other) started returning a 500 error. This isn't intermittent - it's returning this error on every request so an exponential backoff just hits the cap I've set (5).
There's nothing of value in the response but here it is:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "internalError",
"message": "Internal Error"
}
],
"code": 500,
"message": "Internal Error"
}
}
I get the same error when querying with the API explorer, so this seems to be an issue with the sheet itself as opposed to a coding problem. Here's the request URL:
https://www.googleapis.com/drive/v3/files/1KYDm4gqaCLipQTskbqQbesq8ON7CmV_4IscF8V0FZrs/revisions?key=YOUR_API_KEY
What could suddenly cause this change in behavior?

Google Search Console 401 Bad Request issue without using Client Library

So, Here are 3 steps.
I called oAuth2 with following url:
https://accounts.google.com/o/oauth2/v2/auth
?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fwebmasters%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fwebmasters.readonly
&client_id=___.apps.googleusercontent.com
&redirect_uri=urn:ietf:wg:oauth:2.0:oob
&response_type=code
&approval_prompt=force
&access_type=offline
I get the code, suppose: 4/QVgPaCMqp94____qBC4NY_d54IcRj7U9mJc
Then I'm making a request for access_token, by making a POST request to https://accounts.google.com/o/oauth2/token with client_id, client_secret, redirect_uri, grant_type, and I get a JSON like:
'access_token' => ya29.CjHzAgC4js6Guv-1pt_rE____q8XIxiXOXOaSZW9NLRjKCTI3izBi,
'expires_in' => 3600,
'refresh_token' => 1/dL3ENA-EVI0rEb6D-OGqw_____iFe2ZNdEq4,
Now, I am making a request with that access_token or in cases of expiry with a renewed access_token to Google Search Console, which I have added in scopes.
My request is similar to this: https://developers.google.com/webmaster-tools/v3/urlcrawlerrorssamples/list#try-it
But I get an 401 unauthorized error, with a json like following:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Considering I have done the process correctly, I think I have missing some parameters or providing some wrong value.
I have not used Google Client Library, instead used the REST API framework directly.
Can anybody give some clue please? Thank you.
The reason is, URL query parameter must be ?access_token= and not ?key= The later can be used only in case of direct API access and not oAuth.