我尝试从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
和consumer_secret
,但在https://apps.twitter.com我有consumer_key
和consumer_secret
?我试过两个,但得到同样的错误。