TechCrunch Hackathon Douban API

Uploaded on

douban api in hackathon 2011 Beijing

douban api in hackathon 2011 Beijing

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Douban API laiwei@douban.com 2011-10-29
  • 2. What is Douban• Community• Book• Movie• Music• FM• AlphaTownExplore Life, Express Youself, Share Lifevia
  • 3. Why Douban• 50M+ Registered Users• 600+ Cities• 250,000+ Groups• 30000+ Sites• 1000+ Cinemas
  • 4. Douban APIs• Miniblog/Shuo• OpenID• Books/Movies/Music• Photos• Reviews• Collections• Notes• Events• Recommendations• Tags• Dou-mailvia
  • 5. Powered by Douban API• DoubanShuovia
  • 6. Powered by Douban API• Douban FM• Douban Movie• Douban Bookcart• AlphaTown
  • 7. Powered by Douban API• Third-party Appsvia
  • 8. Douban Open Platform• OpenID• API
  • 9. Douban OpenID• 3rd-party sites and applications can let visitors sign in using their douban id
  • 10. Inside Douban API• using OAuth 2.0 to access douban APIs• The core concepts are simple: – Your application asks for a particular scope of access – Douban displays an OAuth page to users, asking for consent to authorize access to your application – If the user approves, your application will get a shortlived access token that you can use to validate requests for the users data and a long-lived refresh token.
  • 11. Inside Douban API• Today Douban supports three flows of OAuth 2.0 – The client-side flow for JavaScript applications running in a browser – The server-side flow for web applications with servers that can securely store persistent information – The native application flow for desktop and mobile applications
  • 12. Apply Douban Apikeygo to douban will return a apikey and secret:• apikey="047e255f2309478c0d7a701d691bd6a4"• secret="0253348fa4d10541
  • 13. Modify Apikey Propertiesgo to
  • 14. Client Side Flow1. get access token GET client_id=047e255f2309478c0d7a701d691bd6a4& redirect_uri= response_type=token& scope=shuo_basic_r,shuo_basic_w2. use access_token access api curl "" -H "Authorization: Bearer ee905e14b2e427cccbb11a3e18ac7764"
  • 15. Server Side Flow2 steps to obtain access_token
  • 16. Server Side Flow1.get authorization codeGET,shuo_b
  • 17. Server Side Flow2. get access_token using the code that first step returnedcurl "" -H "Authorization: Bearer ee905e14b2e427cccbb11a3e18ac7764" -d "client_id=047e255f2309478c0d7a701d691bd6a4&client_secret=0253348fa4d10541&redirect_uri="
  • 18. Server Side Flow3. use access_token access APIscurl "" -H "Authorization: Bearer ee905e14b2e427cccbb11a3e18ac7764
  • 19. Native-application FlowThe same as server side flow
  • 20. Q&Athanks