我在解析服务器仪表板中看到“ authData”字段,并且看到用户可以从Twitter访问我的(“消费者密钥机密”)。 这是我看到的数据: [
other-theme
用户能够看到我的消费者密钥秘密的风险是什么?我可以避免这种情况吗?谢谢!
这是我要登录的代码:
{
"twitter": {
"consumer_key": "XXXXYAJ",
"auth_token": "ABCDCODESAMPLEXXX87",
"screen_name": "nameUserSample",
"consumer_secret": "HEREISSHOWINGMYCONSUMERKEYSECRET",
"id": "7777777777777",
"auth_token_secret": "SECR3TAUTHTOK3N"
}
}
我正在使用此按钮:
bt_conectarTwitter.setCallback(new com.twitter.sdk.android.core.Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
dialogLoading.showDialog(getContext());
// Do something with result, which provides a TwitterSession for making API calls
Log.i("lul", "success: " + result);
TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
TwitterAuthToken authToken = session.getAuthToken();
final String tokenUserTwitter = authToken.token;
final String secretTokenUserTwitter = authToken.secret;
final String userId = String.valueOf(session.getUserId());
final String userName = session.getUserName();
ParseTwitterUtils.logIn(userId,userName,tokenUserTwitter,secretTokenUserTwitter, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
if (user == null) {
Log.d("MyApp", "Uh oh. The user cancelled the Twitter login.");
} else if (user.isNew()) {
newUserFromTwitter();
saveTokensTwitter(tokenUserTwitter,secretTokenUserTwitter);
Log.d("MyApp", "User signed up and logged in through Twitter!");
} else {
if (ParseTwitterUtils.isLinked(user)){
String authToken = ParseTwitterUtils.getTwitter().getAuthToken();
String secretToken = ParseTwitterUtils.getTwitter().getAuthTokenSecret();
saveTokensTwitter(authToken,secretToken);
}
Log.d("MyApp", "User logged in through Twitter!");
goToMainActivity();
}
}
});
// saveTokensTwitter(tokenUserTwitter,secretTokenUserTwitter);
Log.i("lul", "success: " + authToken.token);
}
@Override
public void failure(com.twitter.sdk.android.core.TwitterException exception) {
// Do something on failure
Log.i("lul", "fail: " + "fail");
}
});
您可以通过此按钮here
查看文档