본문 바로가기

twitter

트위터 API 공부 - Getting Started with OAuth


출처: http://www.twitterizer.net/tutorials/getting-started-with-oauth/

닷넷 기반으로 개발하려고 여기 저기 뒤진 결과 찾아낸 사이트인데 영어사이트이다.
이럴때 영어 못하는게 참 한이 된다.
크롬의 자동 번역 시스템도 아직은 쓸만한 단계도 아닌거 같고 ㅡ,.ㅡ;

OAuth is a protocol designed to allow applications access to sensitive information while retaining control and security for the user.

(트위터 API를 공부하려고 여기저기 돌아다니다 보니까 젤 처음 나오는게 OAuth였다. 트위터 API를 사용하려면 역시 트위터로부터 인증을 받아야 사용가능하기 때문인거 같다)
OAuth는 어플리케이션이 유저의 민감한 정보(로긴정보같은)에 접근할 수 있도록 디자인 된 프로토콜이다.

OAuth를 사용하면 개발자는 사용자에게 로긴정보를 요구하지 않아도 된다. 대신 개발자는 어떤 토큰같은걸 받게 된다. 이 토큰은 결국 유저가 위임한 인증서같은 역할을 하게 되어 개발자는 이 토큰을 가지고 유저를 대신해서 여러 역할을 할 수 있게 되는 것이다.

Before you begin working here, you must have your application registered with Twitter. You can go here to register a new application and obtain your consumer key and secret.

이런 개발을 하기 전에 개발자는 먼저 자신의 어플리케이션을 트위터에 등록하여야만 한다. http://twitter.com/apps/new 에 가서 개발자용 consumer key and secret 을 받도록 하자.

어플 등록을 위해 내가 입력한 내용들(여기 언급안된 내용은 비워둬도 된다)

어플 이름: TimelineManager
Description: You can search linked writings on your timelines
Application Website: http://seoddong.tistory.com
Application Type: browser
Callback URl: http://seoddong.tistory.com
Default Access type: Read & Write



이 토큰은 다음과 같은 메쏘드를 사용하여 얻을 수 있다.
OAuthUtility.GetRequestToken("consumer key", "consumer secret");

이 문장은 OAuthTokenResponse 객체를 반환한다. 이 객체는 다음의 4가지 속성을 포함하고 있다:

Token, TokenSecret, UserId, ScreenName