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.

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.