C4W4 - Data Loss Prevention: Qwik Start - JSON

I cant pass the secont check my progress. When trying to complete this instruction:

  1. Use curl to make a content:inspect request, replacing ACCESS_TOKEN with the string that was returned in the previous step and PROJECT_ID with your lab project ID:

with this command:

curl -s
-H “Authorization: Bearer ACCESS_TOKEN
-H “Content-Type: application/json”
https://dlp.googleapis.com/v2/projects/$**PROJECT_ID**/content:inspect
-d @inspect-request.json -o inspect-output.txt

replacing the respectives key terms as instructed, my inspect-output.txt get his result:

{
“error”: {
“code”: 401,
“message”: “Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.”,
“status”: “UNAUTHENTICATED”,
“details”: [
{
@type”: “type.googleapis.com/google.rpc.ErrorInfo”,
“reason”: “ACCESS_TOKEN_TYPE_UNSUPPORTED”,
“metadata”: {
“service”: “dlp.googleapis.com”,
“method”: “google.privacy.dlp.v2.DlpService.InspectContent”
}
}
]
}
}

I checked other similar problems at this forum and no accurate solution was given.
I cannot complete the specialization without this. Does anyone know what’s the problem with that?

1 Like

Hello @Graziella_Cardoso_Bo
I think there might be a typo when you are replacing your ACCESS_TOKEN/PROJECT_ID!

Make sure you have replaced “ACCESS_TOKEN” and “PROJECT_ID” with the actual access token and actual lab project ID respectively

I did replace them as I stated: “replacing the respectives key terms as instructed, my inspect-output.txt get his result:”

Any other idea? I cant figure this out

I had the same output when I didn’t replace the access token and project_id. Try to execute the commands again just by replacing the access token you get it when this command is executed(gcloud auth print-access-token->Task-2 3rd one) and also replace the project_id in both inspect-request.json and new_inspect_file.json. Once you have made these changes you won’t seeing the same output. This is what I observed in this assignment. Hope this helps you as well.

I did this and yet, same message

Hi, it seems I cant try more then one time. Is there a tech support for my problem?

Please reach out to qwiklab help centre for more tech support

Hi, I was going to try my last possible time (5/5) and reach out to qwiklab help centre as sugested, but the words “clean the cache” tackled my mind. I did this and everything turned out ok. I finally finished this assignment. Thank you.

@Graziella_Cardoso_Bo Did you solve your problem ?
I am also facing the same problem. I cannot complete the specialization without this.
Can you please help me to solve the problem?

Hello Sagid, the only thing I did was clear the cache and it worked. Did you try to do this already?

@Graziella_Cardoso_Bo
Thanks for your prompt reply.
How you cleared your cache ?
export PROJECT_ID=[YOUR_PROJECT_ID] in my case this is the instructed command but for others it was different.
is there any issue with the command ?

It really was a different command. Maybe its another task. Can you write the whole task?
In order to clear the cache, go to settings of your browser. I dont know where it is in you browser, but if you put on google How to clear cache, the instructions simple and easy.

use below code:

curl -s
-H “Authorization: Bearer $(gcloud auth print-access-token)”
-H “Content-Type: application/json”
https://dlp.googleapis.com/v2/projects/$PROJECT_ID/content:inspect
-d @inspect-request.json -o inspect-output.txt

Hi i faced the same issue than described above , however with using the code above i get the following message :
{
“error”: {
“code”: 400,
“message”: “Malformed parent field: "projects/".”,
“status”: “INVALID_ARGUMENT”
}
}