react native – Issue with joining Agora channel and logging in agora-rnuikit – JOIN_CHANNEL_ERR_USER_NOT_LOGGED_IN
I am using the Agora React Native UIKit (agora-rn-uikit) to integrate Agora’s video call functionality into my React Native application. However, I am encountering an issue where I am unable to join a channel after logging in. Specifically, when I attempt to join a channel, I receive the errors:
- ConnectionStateChanged CONNECTING LOGIN,
- login error Error: LOGIN_ERR_REJECTED,
- join RTM channel rmhpjfub,
- ConnectionStateChanged DISCONNECTED LOGIN_FAILURE,
- joinChannelError: Error: JOIN_CHANNEL_ERR_USER_NOT_LOGGED_IN,
- sendMessage Error: CHANNEL_MESSAGE_ERR_USER_NOT_LOGGED_IN,
Here is the code I’m using to log in and join the channel:
const initializeSession = async () => {
try {
setLoading(true);
const res = await fetchSession(session_id, token);
if (res) {
console.log('Session:', res?.info?.session?.channel);
setConnectionData({
appId: agoraAppId,
channel: res?.info?.session?.channel,
rtmUid: userId,
username: user.user_type == 'doctor' ? 'Doctor' : 'Patient',
rtmToken: null,
rtcToken: null,
});
}
} catch (error) {
console.error('Error fetching session:', error);
} finally {
setLoading(false);
}
};
initializeSession();
}, []);
```
Read more here: Source link
