我正在尝试制作一个可以放入市场的应用程序来阅读电子表格中的内容。
在我在java的本地开发中,我的授权总是以下类型:
import {Component, OnInit} from '@angular/core';
import {HttpClient, HttpErrorResponse, HttpResponse} from '@angular/common/http';
@Component({
selector: 'git',
templateUrl: './git.component.html'
})
export class GitComponent implements OnInit {
constructor(private http: HttpClient) {
}
ngOnInit(): void {
const headers = {authorization: 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJzYXNobyIsImF1dGgiOiJST0xFX1VTRVIiLCJleHAiOjE1MjQwODcyMzJ9.MUv5RgI9LxQyrrCfjfX8HR2-XiQmz4vjLqH7V_0Du7VFLC0WrK_y3FfeNoT2Nj_uguIK2ss7jv-LNiHuCGtz4A'};
this.http.get('http://localhost:8080/links/all', headers)
.subscribe((e) => {
console.log(e);
}, (err: HttpErrorResponse) => {
console.log(err);
});
}
}
如何安装应用并授权拥有所有权限,该代码如何在不使用p12的情况下获取凭据?
非常感谢
答案 0 :(得分:0)
您可以下载一个JSON版本的密钥而不是P12,只需一次调用即可创建GoogleCredentials
。