谷歌联系API 401错误RestClient :: Unauthorized

我想使用Restclient从Ruby on rails中的用户检索Google联系人,但我每次尝试时,都会在查询行上遇到Restclient 401 Unauthorized错误。 我认为我的查询错误或错误,但我在Google Contact API文档中找不到任何有用的信息。 任何的想法 ?

这是我的范围

scope = 'https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile+https://www.google.com/m8/feeds/contacts/default/full/+https://mail.google.com/mail/feed/atom/+https://www.googleapis.com/auth/calendar' 

这是我用新接收的access_token调用的方法

 def import_google_contact(user_email, access_token) r = RestClient.get "https://www.google.com/m8/feeds/contacts/#{user_email}/full?access_token=#{access_token}" ... end 

这很奇怪,因为我设法在使用此请求的同一方法之前获取用户电子邮件

 r = RestClient.get "https://www.googleapis.com/oauth2/v2/userinfo?access_token=#{access_token}" 

我发现我没有在范围内放置正确的参数来请求联系人数据? 我替换了它

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

这很奇怪,因为Google在授权过程中接受了错误的一个