Open AKK-Tech opened 2 years ago
I am adding temp token then also giving error of "LOGIN_ERR_INVALID_TOKEN" , as i am integrating Live chat Followed this Code : https://github.com/AgoraIO/RTM/tree/master/Agora-RTM-Tutorial-Android still getting "LOGIN_ERR_INVALID_TOKEN"
As you can see:
/**
* API CALL: login RTM server
*/
private void doLogin() {
mIsInChat = true;
mRtmClient.login(null, mUserId, new ResultCallback<Void>() {
@Override
public void onSuccess(Void responseInfo) {
Log.i(TAG, "login success");
runOnUiThread(() -> {
Intent intent = new Intent(LoginActivity.this, SelectionActivity.class);
intent.putExtra(MessageUtil.INTENT_EXTRA_USER_ID, mUserId);
startActivity(intent);
});
}
@Override
public void onFailure(ErrorInfo errorInfo) {
Log.i(TAG, "login failed: " + errorInfo.getErrorCode());
runOnUiThread(() -> {
mLoginBtn.setEnabled(true);
mIsInChat = false;
showToast(getString(R.string.login_failed));
});
}
});
}
The token is hardcoded to null
. If your Agora project enables tokens, this project will fail. You can update null
with your token.
As you can see:
/** * API CALL: login RTM server */ private void doLogin() { mIsInChat = true; mRtmClient.login(null, mUserId, new ResultCallback<Void>() { @Override public void onSuccess(Void responseInfo) { Log.i(TAG, "login success"); runOnUiThread(() -> { Intent intent = new Intent(LoginActivity.this, SelectionActivity.class); intent.putExtra(MessageUtil.INTENT_EXTRA_USER_ID, mUserId); startActivity(intent); }); } @Override public void onFailure(ErrorInfo errorInfo) { Log.i(TAG, "login failed: " + errorInfo.getErrorCode()); runOnUiThread(() -> { mLoginBtn.setEnabled(true); mIsInChat = false; showToast(getString(R.string.login_failed)); }); } }); }
The token is hardcoded to
null
. If your Agora project enables tokens, this project will fail. You can updatenull
with your token.
Thanks Alot it worked perfectly fine now 👍 , but how to check chatting functionality (Peer to peer & Channel Message) as I had install app in two devices and used sam temp token and set channel name as userA , when login with Account name : userA , but when login in other phone with userB then login fail , and when login with userA then it success, but how can I chat with my self , that not possible , how to login with Account name : userB so that I can test chatting functionality.
That's the tricky part. UserA and UserB have different tokens.
https://docs.agora.io/en/AgoraPlatform/get_appid_token?platform=AllPlatforms
wow.. means creating API to get tokens for all different users is a must it cant work with only temp token...!
Could you please show me how to generate an RTM token or how to get it? When I log in with the application, it always responds "LOGIN_ERR_INVALID_TOKEN".