Search code examples
androidgoogle-cloud-platformandroid-management-api

Android Management API - Caller is not authorized to manage enterprise


Good morning, I am setting up my server with Android Management API, but I am having some problems.

I followed all quickstart guide to link: https://developers.google.com/android/management/quickstart

I am able to get the oauth token and JWT but I am not able to get my basic policy because I get the error on https://androidmanagement.googleapis.com/v1/enterprises/{MY_ENTERPRAISE_ID}/policies/{MY_POLICY}:

error: {code: 403, message: "Caller is not authorized to manage enterprise.", status: "PERMISSION_DENIED"}

code: 403 message: "Caller is not authorized to manage enterprise." status: "PERMISSION_DENIED"

How can I solve this issue?


Solution

  • To call the API from a server, you need to enable the Android Management API for your project and create a service account. To access the Android Management API your service account requires the androidmanagement.enterprises.manage permission, which can be granted by the roles/androidmanagement.user role. Kindly refer to this to know more about creating a service account.