0
我試圖訪問日曆的詳細信息,但我似乎得到一個無效的憑據錯誤。 我訪問以下網址: 「https://www.googleapis.com/calendar/v3/calendars/ {} google_id /事件」谷歌日曆api 3無效的憑據錯誤
這樣的:
DefaultHttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(url_);
get.addHeader("Authorization","OAuth" + auth_token);
try {
HttpResponse response = client.execute(get);
什麼額外的頭,我應該放在那裏?我從Android應用程序訪問它。如果有問題,我通過以AccountManager.newChooseAccountIntent()開始的活動獲得我的auth_token。
我得到以下JSON:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}