大家好,最近我在Android上为Twitter登录用户整合数字,现在之前它工作正常,但现在我不知道发生了什么但是几次登录后显示此错误
HTTP错误:403禁止,API错误:239,用户消息:再试一次
现在可以有人请告诉我我做错了也可以有人请告诉我,在消费者密钥和消费者秘密中,我必须通过dev.twiiter我的应用凭据或面料消费者密钥和秘密,这件事真的非常因为在docs中他们构思了twitter键,但是在一些stackoverflow问题上,人们会说使用数字键?另外,我没有从应用程序扩展我的活动会导致任何问题吗?
我的代码在下面给出请告诉我我做错了什么对我来说真的很有帮助
public class Signup_firststageActivity extends AppCompatActivity {
private AuthCallback authCallback;
public AuthCallback getAuthCallback(){
return authCallback;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup_firststage);
TextView text = (TextView)findViewById(R.id.text);
Bundle b = getIntent().getExtras();
if (b.getString("error") == null) {
} else {
if (b.getString("error") != null && b.getString("error").equals("server_down")) {
text.setText("Error 503 Please Try Again");
} else {
}
}
//Twitter
TextView tryagain = (TextView)findViewById(R.id.tryagain);
tryagain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Digits.authenticate(new DigitsAuthConfig.Builder().withAuthCallBack(authCallback).withPhoneNumber("+918972745648").build());
}
});
final TwitterAuthConfig authConfig = new TwitterAuthConfig("agfjgD6wetDXdjfjuC4ywwoeD", "BshdjfjfwGz8WLaofkjfjsfjjsjsfhKpv60hQxni60oZwAu");
Fabric.with(getBaseContext(), new TwitterCore(authConfig), new Digits());
authCallback = new AuthCallback() {
@Override
public void success(DigitsSession session, String phoneNumber) {
Log.d("digits", "success phoneNumber: " + phoneNumber);
Log.d("digits", "session " + session.getPhoneNumber() + " " + session.toString() + " " + session.isValidUser() + " " + session.getAuthToken() + " " + session.getId());
// TwitterAuthConfig authConfig = TwitterCore.getInstance().getAuthConfig();
progressDialog = new ProgressDialog(Signup_firststageActivity.this);
progressDialog.setIndeterminate(true);
progressDialog.setMessage("Please Wait... ");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.getWindow().setGravity(Gravity.CENTER);
progressDialog.show();
TwitterAuthToken authToken = (TwitterAuthToken) session.getAuthToken();
OAuthSigning oauthSigning = new OAuthSigning(authConfig, authToken);
Map<String, String> authHeaders = oauthSigning.getOAuthEchoHeadersForVerifyCredentials();
Log.d("digits", "authHeaders: 1" + authHeaders);
Signup_MobileNumber_requestData(session.getPhoneNumber());
Digits.getSessionManager().clearActiveSession(); // don't know should i write this here or not ??
}
@Override
public void failure(DigitsException exception) {
Log.d("digits", "failure");
// Do something on failure
}
};
DigitsAuthButton digitsButton = (DigitsAuthButton) findViewById(R.id.auth_button);
digitsButton.setCallback((this).getAuthCallback());
digitsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("digits", "button click");
}
});
}
提前谢谢
答案 0 :(得分:3)
由于密钥和密钥而发生此问题。我试图从Fabric仪表板复制值,我得到了同样的错误。
当我从Fabric-Android Studio Plugin-&gt; Digits-&gt; Install-&gt; Apply
获取值时,它工作正常