我已将服务帐户密钥与json文件一起使用,但其返回的访问令牌为null。如何获取访问令牌?
代码:
File jsonKey = new File(JOSN_FILE");
InputStream inputStream;
inputStream = new FileInputStream(jsonKey);
GoogleCredential credential = GoogleCredential.fromStream(
inputStream, httpTransport, JSON_FACTORY);
System.out.println("access token : "+credential.getAccessToken());
输出:访问令牌:空