Google CardDAV API 403错误 [英] Google CardDAV API 403 Error

查看:108
本文介绍了Google CardDAV API 403错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用Google的CardDAV API(并且我已经成功使CalDAV访问得以正常进行).不幸的是,在尝试发现用户的当前用户本金时,我一直收到403错误. FWIW,我已经转到Google的开发者控制台并设置了客户信息,对于CalDAV的访问它似乎工作得很好.

I've been trying to use Google's CardDAV APIs (and I've successfully gotten CalDAV access working). Unfortunately, I keep getting a 403 error when trying to discover the user's current-user-principal. FWIW, I have gone to Google's Developer Console and set up client information and it seems to work perfectly fine for CalDAV access.

以下是CardDAV的HTTP通信量的片段:

Here is a snippet of the HTTP traffic for CardDAV:

PROPFIND https://www.googleapis.com:443/.well-known/carddav/
Depth: 0
Content-Type: text/xml
Brief: T
Authorization: Bearer ya29.1.AADtN_UD1CVKpIQPsyB4HzoKVxt4L5kPFXU3GucMTfJmJj9t0pzZqX1i3Xx748Y
<?xml version="1.0" encoding="utf-8"?>
<x0:propfind xmlns:x0="DAV:">
  <x0:prop>
    <x0:current-user-principal />
    <x0:principal-URL />
    <x0:resourcetype />
  </x0:prop>
</x0:propfind>

vvvvvvvvvvvv

HTTP PROPFIND Status(403) Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<errors xmlns="http://schemas.google.com/g/2005">
 <error>
  <domain>GData</domain>
  <code>insufficientPermissions</code>
  <internalReason>Insufficient Permission</internalReason>
 </error>
</errors>

如果有人对为什么会发生这种情况有所了解,将不胜感激.

If anyone has some insight as to why this might be happening, it would be greatly appreciated.

红色

推荐答案

我今天一直在玩这个游戏,并且刚刚成功. 我正在使用两个oauth范围

I have been playing around with this today and succeeded just now. I am using two oauth scopes

https://www.googleapis.com/auth/carddav

https://www.google.com/m8/feeds

仅使用第二个时,我就得到了403. 然后,我在getetag上执行深度1 propfind,然后在multiget上执行vcards. 响应速度非常快.

I was getting a 403 when just using the second one. I then do a depth 1 propfind on getetag and then a multiget to get the vcards. The response is super speedy.

p.s.使用您正在使用的URL,您还将获得一个http-重定向

p.s. With the URL you are using you will also get an http-redirect

这篇关于Google CardDAV API 403错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆