Hi,
Please help, im trying to publish a teams app using the Azure Graph Api however it isnt working, im getting this error:
{"error":{"code":"Forbidden","message":"User not authorized to perform this operation. UserId:..... TenantId: .....
Im not sure what else to do, heres my code:
# URL to request the token
token_url="https://login.microsoftonline.com/$tenant/oauth2/v2.0/token"
data="client_id=$client_id&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default&client_secret=$client_secret&grant_type=client_credentials"
response=$(curl -s -X POST -d "$data" -H "Content-Type: application/x-www-form-urlencoded" "$token_url")
access_token=$(echo "$response" | jq -r '.access_token')
file_location="@manifests/myApp/manifest.zip"
echo "Access Token: $access_token"
#POST request, doesn't work
-H "Authorization: Bearer $access_token" \
-H "Content-type: application/zip" \
--data-binary "$file_location" \
"https://graph.microsoft.com/beta/appCatalogs/teamsApps"
#Get Request (Works perfectly fine)
#curl -s -H "Authorization: Bearer $access_token" -H "ConsistencyLevel: eventual" "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps"
Heres my request token body that contains the roles:
",
"roles": [
"AppCatalog.ReadWrite.All",
"Directory.ReadWrite.All"
],
Any help is greatly appreciated, i'm not sure what else to try.
Kind Regards,
Jack.