crawd4274
@crawd4274 (安藤 亮介)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

video intelligenceのAPIKEY認証って通らなくなりました?

解決したいこと

GCPのcloud video intelligenceのAPIにAPIKEY認証でアプリケーションを作ってました。
そこで先週の木曜日からAPIKEY認証が通らなくなりました。

以下のコードでエラーが返ってきます。

発生している問題・エラー

{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. 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"
  }
}

該当するソースコード

fish
# Step 1: Create a .tmp directory if it doesn't exist
mkdir -p .tmp

# Step 2: Encode the video file to base64 and save to a file in the .tmp directory
base64 -i .data/video.mp4 > .tmp/encoded_video.txt

# Step 3: Use the encoded video in the curl command, with the API key from the GCP_API_KEY environment variable
set api_key (echo $GCP_API_KEY)

# Using 'cat' to read the file and 'echo' to create the JSON payload
set encoded_video (cat .tmp/encoded_video.txt)
set json_payload (echo "{\"inputContent\": \"$encoded_video\", \"features\": [\"EXPLICIT_CONTENT_DETECTION\"]}")

curl -X POST \
  "https://videointelligence.googleapis.com/v1/videos:annotate?key=$api_key" \
  -H "Content-Type: application/json" \
  -d "$json_payload"

自分で試したこと

nodejsで書き換えたり、プロジェクトやアカウントを切り替えたりしましたが、エラーは変わらず。

0

No Answers yet.

Your answer might help someone💌