0

Brightcove の API ドキュメントには次のように書かれています。

承認: 基本 {client_id}:{client_secret}

{client_id}:{client_secret} 文字列全体が Base64 エンコードされている必要があります (curl は --user 資格情報として渡すと、文字列を自動的に Base64 エンコードします。他の言語では、Base64 エンコードを自分で処理する必要があります)。 .

これは、ID とシークレットを個別にエンコードするということですか、それともすべてをエンコードするということですか? 私は何が間違っているのかまだわかりません。この時点での私のコードは次のとおりです。

id_key = b64encode('myid12345qwerty'.encode()).decode("utf-8")
secret_key = b64encode('mysecret12345qwerty67890'.encode()).decode("utf-8")
creds = '{'+id_key+':'+secret_key+'}'
headers = {'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic ' + creds}

r = requests.post('https://oauth.brightcove.com/v4/access_token?grant_type=client_credentials', headers = headers)
print(r.status_code)
print(r.text)

これにより、client_id パラメータを取得していないというエラーが発生します。

{"error":"invalid_client","error_description":"The "client_id" parameter is missing, does not name a client registration that is applicable for the requested call, or is not properly authenticated."}

ここでのポインタに感謝します。

4

1 に答える 1