缺少必需的参数:在 ionic2 中访问 google 令牌时 grant_type
错误:-
{
"error" : "invalid_request",
"error_description" : "Required parameter is missing: grant_type"
}
Run Code Online (Sandbox Code Playgroud)
代码
let creds=JSON.stringify({
'client_id':'251059024984-8113pdtb11gm8m4evdq59stlpvcab8cn.apps.googleusercontent.com',
'client_secret':'uVWZt_Vd5mMLXGQDo7lmAIUe',
'redirect_uri':'http://localhost/callback',
'grant_type':'authorization_code',
'code':data
});
var headers = new Headers();
headers.append('Content-Type', 'application/x-www-form-urlencoded');
console.log(data)
this.http.post('https://accounts.google.com/o/oauth2/token',creds,{headers: headers}).map(res => res.json()).subscribe(data => {
console.log(data)
},(error)=>{
console.log('error in', error);
})
Run Code Online (Sandbox Code Playgroud)
当我检查 Postman 中的 api 时,它运行良好
input_table
username input
A A10
B A9
C A8
D A7
E A0
F A4
Run Code Online (Sandbox Code Playgroud)
像这样
如何通过从'input'字段中删除'A'char来查找输入的总和