I've successfully obtained the api key from huawei by creating a API client on the huawei connect portal (This was created by specying the name, N/A in project field and Assigned roles as administrator)
However when I try to call the API to obtain the upload URL so that I can upload my app to the store it returns with the following error : {"ret":{"code":205524993,"msg":"client token auth failed"}}
This is my powershell script I'm using to do this:
#obtaining API key
$tokenHeader = @{
"Content-Type"="application/json"
}
# Token request payload
$tokenRequest = @{
grant_type = "client_credentials"
client_id = $ClientId
client_secret = $ClientKey
} | ConvertTo-Json
# Get Access Token
write-host "retrieving access token"
$accessTokenResponse = Invoke-WebRequest -Uri $authUrl -Method POST -Headers $tokenHeader -Body $tokenRequest
#obtaining Upload url
$url = "https://connect-api.cloud.huawei.com/api/publish/v2/upload-url/appId=$appId&suffix=aab"
$headers = @{
"client_id" = "$clientId"
"Content-Type" = "application/json"
"Authorization" = "Bearer $accessTokenResponse.content"
}
$response = Invoke-RestMethod -Uri $uri -Method Get -Headers $headers