开发者

Google Data API: OAuth authenticate URL instead of authorize URL?

I'm accessing the Google Contacts API usin开发者_C百科g OAuth.

I see from the docs that I have an authorize URL (https://www.google.com/accounts/OAuthAuthorizeToken), used to get the access token, but not an authenticate URL, a thing other services implementing OAuth use to automatically redirect the user to my site when he has previously given me the permission to access his data.

Linkedin does it

  • https://www.linkedin.com/uas/oauth/authorize
  • https://www.linkedin.com/uas/oauth/authenticate

Twitter does it

  • https://twitter.com/oauth/authenticate
  • https://twitter.com/oauth/authorize

But I couldn't find a way to do this using the Google API.

Anyone knows if it's there? Thanks


Google uses the same url for authentication and authorization, so just redirect your users to the authorize url with the appropriate parameters in the query string. Google then determines if the user needs to login, authorize your app, or both.

The flow would go something like this...

  1. Get the request token

  2. Redirect your users to the authorization link

    https://www.google.com/accounts/OAuthAuthorizeToken?scope=http%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds&oauth_token=REQUEST_TOKEN&oauth_callback=http%3A%2F%2Fwww.mysite.com%2Fcallback

  3. User authorizes your app, then exchange the requst token for an access token.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜