Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Access restricted Google My Maps and access it through Javascript API

I'm trying to access restricted Google My Maps using Maps JavaScript API.

The map is shared on Drive with restricted access for users.

For accessing the restricted map through Maps JavaScript API

  • I have created the API Key from Google Console Cloud
  • Created a Service Account
  • Shared the private map with that Service Account Email

Unfortunately, it doesn't work even if I share the private maps with the service account I make the map public it does work.

One thing is if I make a call to Drive API using the Same API Key and list files, I can see that the shared My Maps is there so the permission definitely applied even though it doesn't work when I try to load that with the Maps API using the KML link

0 1 1,275
1 REPLY 1

I've tried the mentioned things. The maps work (using KML) with Javascript API if it is shared as public, But it stops working when I make it restricted where I definitely shared with the Service Account email. The thing is if I make a call to Drive API using the Same API Key and list files, I can see that My Maps is there so the permission definitely applied even though it doesn't work when I try to load that with the Maps API