2010-07-16 2 views
2

트윗을 게시하려면 로그인 인증을해야합니다. this link에서 Jtwitter.jarSignPost.jar 파일을 받았습니다. 지금까지 검색 한 xAuth Authendication이 더 효율적입니다. 하지만 아직 간단한 자습서 나 로그인 Authendication을위한 코드 조각을 얻지 못했습니다. this Article을 발견하고이 코드를 사용했습니다. thats는 NullPointerException이됩니다.Twitter Login 안드로이드 인증?

고객 키를 생성했고 비밀 키는 jar 사이트가있는 코드를 사용했습니다. 그러면 Verification Error이됩니다.

사용자의 사용자 이름과 비밀번호를 확인하기 위해 따라야 할 몇 가지 아이디어 나 단계를 알려주십시오.

편집 :

나는 user's account에서에 게시 할

. Jtwitter 또는 Oauth이든 Api를 사용하려면 무엇을 선호합니까? 나에게 How-to 또는 Related Articles을 말해 주시겠습니까?

답변

4

은을 heres

을 heres video

JTwitter 기본 autentication위한의 OAuthocalypse을 피 리옹 EMDE 안드로이드

http://github.com/brione/Brion-Learns-OAuth 트위터에 대한 의 OAuth를 구현하는 좋은 예이다 8 월 16 일 twitter aunthentication이 곧 변경됩니다 http://www.4psmarketing.com/blog/world-cup-2010-delays-twitter-oauthocalypse

+0

이미 보았습니다. 그러나 사용자가 사용자 이름과 암호를 입력 할 수있는 옵션이 없습니까? – Praveen

+0

안녕하세요 Praveen 비디오를 보시고 의심스러운 점이 있으면 도와 드리겠습니다. – Jorgesys

+0

Praveen : OAuth는 사용자 이름이나 비밀번호를 직접 처리하지 않습니다. 이 서비스는 사용자를 서비스 (예 : Twitter 로그인 페이지)로 유도하여 인증을받은 다음 사용자가 로그인 한 서비스 (즉, OAuth API에서 제공 한 Twitter OAuth 서비스 URL)를 통해 확인합니다 비밀 토큰을 교환하는 방법. – Dave

1

@ 조르쥬스 - "JTwitter는 기본 인증 용"이라고 잘못 말하면됩니다. JTwitter는 OAuth를 지원하며 예제 코드는 OAuth가 사용되는 것을 보여줍니다. JTwitter documentation

사용자 암호를 수집해야하므로 xAuth가 사용자에게 적합하지 않습니다. xAuth를 사용하려면 트위터 지원에 허가를 요청해야합니다.

그래서 OAuth가 더 효과적 일 수 있지만 사용하는 것이 가장 좋습니다.

Android에서는 사용자를 인증 페이지로 안내 할 수 있습니다. 다음 코드가 작동해야합니다. 콜백을 처리 할 수 ​​있다면 더 매끄럽게 만들 수 있습니다.

// Make an oauth client 
// "oob" is for the slightly clunky enter-your-pin method 
OAuthSignpostClient oauthClient = new OAuthSignpostClient(MY_OAUTH_KEY, MY_OAUTH_SECRET, "oob"); 

// open the authorisation page in the user's browser 
URI url = client.authorizeUrl(); 
Intent myIntent = new Intent(Intent.VIEW_ACTION); 
myIntent.setData(url); 
startActivity(myIntent); 

// TODO Get the pin from the user 
String pinCode; 

oauthClient.setAuthorizationCode(pinCode); 
// Store the authorisation token details for future use 
Object accessToken = client.getAccessToken(); 

// Make a Twitter object 
Twitter twitter = new Twitter("my-name", oauthClient); 
// Set your status 
twitter.setStatus("Messing about in Java");