ios - Twitter API Authentication -
i'm trying pick ios development. i'm creating app myself (will not release) that, dumbed down, takes query input user , searches through twitter using query.
i can use uiwebview
, want use twitter's rest api instead, familiar how apis work. however, can't work because twitter's api requires authentication (something seldom understand).
how authentication work, , can authenticate app use myself?
twitter uses oauth2. this:
+--------+ +---------------+ | |--(a)- authorization request ->| resource | | | | owner | | |<-(b)-- authorization grant ---| | | | +---------------+ | | | | +---------------+ | |--(c)-- authorization grant -->| authorization | | client | | server | | |<-(d)----- access token -------| | | | +---------------+ | | | | +---------------+ | |--(e)----- access token ------>| resource | | | | server | | |<-(f)--- protected resource ---| | +--------+ +---------------+ figure 1: abstract protocol flow
the abstract oauth 2.0 flow illustrated in figure 1 describes the
interaction between 4 roles , includes following steps:(a) client requests authorization resource owner. authorization request can made directly resource owner (as shown), or preferably indirectly via authorization server intermediary.
(b) client receives authorization grant, credential representing resource owner's authorization, expressed using 1 of 4 grant types defined in specification or using extension grant type. authorization grant type depends on method used client request authorization , types supported authorization server.
(c) client requests access token authenticating authorization server , presenting authorization grant.
(d) authorization server authenticates client , validates authorization grant, , if valid, issues access token.
above exceprt spec
please read through this . there sample code in various languages there. , here sample code iphone/ipad
Comments
Post a Comment