Cant print the error message in console from object - xcode

I receive the following object error:
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
I'd like to call an action when the error code is 401 or message is "Invalid Credentials" but the following code does nothing and when I try do console.error("got something:", err["code"]); to log in the console it comes blank:
console.error("got something:", err["code"]);
if (err["code"]=="401") {
console.log("Found error: 401");
this.messageServ.presentMessage("auth_error");
}
return err;

Looks like your not access fields deep enough in your object graph
Try this:
err["error"]["code"]

Related

"code": 403, "message": "User does not have sufficient permissions for this profile."

I follow steps by step with https://github.com/spatie/laravel-analytics#how-to-obtain-the-credentials-to-communicate-with-google-analytics
but I got { "error": { "code": 403, "message": "User does not have sufficient permissions for this profile.", "errors": [ { "message": "User does not have sufficient permissions for this profile.", "domain": "global", "reason": "insufficientPermissions" } ] } }
please help me, I've searched and followed all the solutions. but I also got this error.

provisionCOmposer.js returns error message of "bad host name"

I am following the standard bot framework composer deployment script, as following:
cmd_prompts> node provisionComposer.js
--tenantId=<my tenantid>
--subscriptionId=<my subscriptionid>...
It was working pretty well at the beginning. Then it failed after I deleted several existing resources from my subscription. The following is a copy of the error returned by the provisionComposer.js script:
{
"Code": "BadRequest",
"Message": "The host name nyname01-xyz_env.azurewebsites.net is invalid.",
"Target": null,
"Details": [
{
"Message": "The host name nyname01-xyz_env.azurewebsites.net is invalid."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"ExtendedCode": "04003",
"MessageTemplate": "The host name {0} is invalid.",
"Parameters": [
"nyname01-xyz_env.azurewebsites.net"
],
"Code": "BadRequest",
"Message": "The host name nyname01-xyz_env.azurewebsites.net is invalid."
}
}
],
"Innererror": null
}
Result:
Provision failed
Can anyone shed some light? Appreciate your help.

Google Civic Information API `/voterInfoQuery` route returning 400

When testing the API at this site (https://developers.google.com/civic-information/docs/v2/elections/voterInfoQuery) I only receive a 400 response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Election unknown"
}
],
"code": 400,
"message": "Election unknown"
}
}
is this API still supported?
Yes, the API is still supported. Did you resolve the issue?
If not, make sure you're putting in a valid number for the electionId (2000 should work).

Create and Share bucket in google cloud storage using google api's

i need to create and share a bucket in gcloud storage using google api's. but i got an error when am tring with postman(rest client).
Iam trying with
url
-------
https://www.googleapis.com/storage/v1/b?project=testproject
request body
------------
{
"name":"testbucketmanafnew"
}
i got an error
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
after iam created an access tocken using OAuth 2.0 Playground. And added to header
Authorization = ya29.VALUE_REDACTED
But i got error
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
what did i miss?
using Google api explorer, am able to call api's successfully
POST https://www.googleapis.com/storage/v1/b?project=testproject&key={YOUR_API_KEY}
{
"name": "testmanafcjbucketyy"
}
Authorization needs to be passed in the following format.
Authorization: Bearer [oauth2_token]
if you're using Postman the "Header" field becomes Authorization and the "Value" field becomes Bearer[WHITESPACE][oauth2_token]

https://usercontent.googleapis.com/freebase/v1/imageID return "Domain Type Forbidden"

https://usercontent.googleapis.com/freebase/v1/image/en/jenni_rivera
https://usercontent.googleapis.com/freebase/v1/image/en/bob_dylan
return
{
"error": {
"errors": [
{
"domain": "global",
"reason": "domainTypeForbidden",
"message": "Domain Type Forbidden"
}
],
"code": 403,
"message": "Domain Type Forbidden"
}
}
Do i do somthing wrong? API was changed?
Yes, we're looking into it. Right now the images are available from:
https://www.googleapis.com/freebase/v1/image/en/jenni_rivera
...but it should be switched back to usercontent.googleapis.com very soon.

Resources