我尝试从Digits服务获取 useID ant oAuth 令牌。但是当我输入我的电话号码并按“发送确认码”时,我收到了这个错误:
E/Twitter﹕ Failed to get app auth token
com.twitter.sdk.android.core.TwitterApiException: 403 Forbidden
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:388)
at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at retrofit.Platform$Android$2$1.run(Platform.java:142)
at java.lang.Thread.run(Thread.java:818)
E/Digits﹕ HTTP Error: 403 Forbidden, API Error: 99, User Message: Try Again
我的应用程序类代码:
private AuthCallback authCallback;
@Override
public void onCreate()
{
super.onCreate();
TwitterAuthConfig authConfig = new TwitterAuthConfig(BuildConfig.CONSUMER_SECRET, BuildConfig.CONSUMER_KEY);
Fabric.with(this, new TwitterCore(authConfig), new Digits());
authCallback = new AuthCallback() {
@Override
public void success(DigitsSession session, String phoneNumber) {
// Do something with the session
}
@Override
public void failure(DigitsException exception) {
// Do something on failure
}
};
}
public AuthCallback getAuthCallback(){
return authCallback;
}
我的注册活动代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);
DigitsAuthButton digitsButton = (DigitsAuthButton) findViewById(R.id.auth_button);
digitsButton.setCallback(((MyApplication) getApplication()).getAuthCallback());
}
1.我该如何解决这个错误?2.我应该使用什么consumer_key
?consumer_secret
在https://fabric.io/我有一个consumer_key
and consumer_secret
,但在https://apps.twitter.com我有不同的consumer_key
and consumer_secret
?我都尝试了,但得到了同样的错误。