首页 > 解决方案 > 对 google static api 进行任何请求时得到 403

问题描述

我有以下代码:

String url = "https://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=12&size=400x400&key=<MyApiKey";


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
        .url(url)
        .get()
        .build();

Call call = client.newCall(request);
Response response = call.execute();

System.out.println(response.code());

我已经用我的实际 API 密钥替换了我的密钥。谷歌指标识别请求。但它们都是错误的,我确实有权发出命令

标签: google-static-maps

解决方案


推荐阅读