douzhaxian1267 2013-06-17 18:45
浏览 4

GAE上的oauth2网站

I am using https://code.google.com/p/goauth2/source/browse/oauth/example/oauthreq.go to try to access an admin only (via app.yaml) url on my site:

go run main.go -code CODE

runs against the Google api default url and returns my info:

{
  ...
  "gender": "male",
  "locale": "en-GB"
}

So I've got the right code at least!

But accessing my website (specifying -request_url) returns the HTML for the Google account login page.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Google Accounts</title>

So there's probably something wrong with my GAE setup... The Google APIs Console has the correct "Home Page URL". Any ideas?

I have tried with my custom domain and my appspot domain, but accessing an admin-only url only redirects my client to the Google account login page.

I see the GET request being sent with header Authorization: Bearer CODE.

  • 写回答

1条回答 默认 最新

  • douchuituo3032 2013-10-08 15:35
    关注

    Your application is not an OAuth Consumer. Google is the provider, but your application needs to request access, you as a user need to approve it, and then your application can consume the Google APIs. Sending an OAuth token to your application doesn't get you a session cookie.

    评论

报告相同问题?

悬赏问题

  • ¥15 echarts动画效果失效的问题。官网下载的例子。
  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加