ansible-role-varnish
ansible-role-varnish copied to clipboard
error : Forbidden. Need user.
I/flutter (28267): CB-SDK: : ========================================================= I/flutter (28267): === REQUEST ==== c54759ce-e44f-4dc6-9990-0d44ef9a3691 === I/flutter (28267): REQUEST I/flutter (28267): POST https://api.connectycube.com/chat/Dialog I/flutter (28267): HEADERS I/flutter (28267): {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.7.0, CB-Token: FA1A336CD1F2244C369B15244FB8FCE528AE} I/flutter (28267): BODY I/flutter (28267): {"type":3,"occupants_ids":[10023181]} I/flutter (28267): I/flutter (28267): CB-SDK: : ********************************************************* I/flutter (28267): *** RESPONSE *** 403 *** c54759ce-e44f-4dc6-9990-0d44ef9a3691 *** I/flutter (28267): HEADERS I/flutter (28267): {connection: keep-alive, content-type: application/json; charset=utf-8, date: Thu, 17 Aug 2023 11:51:20 GMT, strict-transport-security: max-age=15768000; includeSubDomains, server: nginx/1.25.0, content-length: 45} I/flutter (28267): BODY I/flutter (28267): {"errors":{"base":["Forbidden. Need user."]}}
@tatanka987 what is the reason behind this error.
right now i am passing static id from user list which i already have and initiating chat.
{"items":[{"user":{"_id":"64dcd5f3558c7f00184ab40a","id":10023181,"created_at":"2023-08-16T13:58:11Z","updated_at":"2023-08-16T13:58:11Z","login":"Shweta}","last_request_at":null,"timezone":null,"email":null,"full_name":null,"phone":null,"website":null,"twitter_id":null,"external_user_id":null,"facebook_id":null,"custom_data":null,"user_tags":null,"avatar":null,"external_id":null,"is_guest":null}},{"user":{"_id":"64dcc0d25eb5be0018d1816f","id":10012726,"created_at":"2023-08-16T12:28:02Z","updated_at":"2023-08-16T12:28:02Z","login":"richaa","full_name":"richaaaa","last_request_at":null,"timezone":null,"email":null,"phone":null,"website":null,"twitter_id":null,"external_user_id":null,"facebook_id":null,"custom_data":null,"user_tags":null,"avatar":null,"external_id":null,"is_guest":null}},{"user":{"_id":"64ddb739558c7f00184be9ad","id":10169154,"created_at":"2023-08-17T05:59:21Z","updated_at":"2023-08-17T10:40:55Z","last_request_at":"2023-08-17T10:40:55Z","login":"sneha","email":"[email protected]","full_name":"
also when i am sending message to opponent i am getting this message in log
Check you set participant and login to the chat
I/flutter (28267): {"errors":{"base":["Forbidden. Need user."]}}
means that if you try to request dialogs using an empty session (without a user), you should call signIn
before, or create the session with the user before calling this API.
I/flutter (28267): {"type":3,"occupants_ids":[10023181]}
if you need to get all private dialogs for the current user you shouldn't set the current user id to the request, the server will return only user-related dialogs, and your user will not receive dialogs where it is not a member, please see our documentation
Check you set participant and login to the chat
means that your CubeDialog
model should contain the occupantsIds
with the actual opponents list and the user should login to the chat before using the chat functionality
Check you set participant and login to the chat
yes , now i worked on it and handled lifecycle state so its working. thanks for such a good help from ur side
15:03:56.271 com.bv.mainCourt I CB-SDK: : ========================================================= 15:03:56.271 I {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.7.0, CB-Token: BB6A7DBBE3803E241269451ED4F91E358E42} 15:03:56.984 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:56.984 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:56.984 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:56.984 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:56.984 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:56.984 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:56.984 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:56.984 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:56.985 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:56.985 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:56.991 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:56.991 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:56.991 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:56.992 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:56.992 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:56.992 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:56.992 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:56.992 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:56.992 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:56.993 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.776 I CB-SDK: : ********************************************************* 15:03:57.779 I CB-SDK: PushNotificationsManager: [init] 15:03:57.781 I CB-SDK: : loginToCubeChat user {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.781 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.784 I CB-SDK: CubeChatConnection: Chat connection SocketOpening 15:03:57.794 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:57.794 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:57.794 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:57.794 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:57.794 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:57.794 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:57.795 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:57.795 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:57.795 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:57.795 I CB-SDK: : Current app state: AppLifecycleState.inactive 15:03:57.834 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.835 I CB-SDK: : login richa = {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.835 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.835 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.835 I CB-SDK: : login richa = {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.835 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.836 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.836 I CB-SDK: : login richa = {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.836 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.837 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.839 I CB-SDK: : login richa = {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.839 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.844 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.847 I CB-SDK: : login richa = {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.847 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.848 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.848 I CB-SDK: : login richa = {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.848 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.848 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.849 I CB-SDK: : login richa = {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.849 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.849 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.849 I CB-SDK: : login richa = {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.849 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.849 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.849 I CB-SDK: : login richa = {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.850 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.850 I CB-SDK: : Current app state: AppLifecycleState.resumed 15:03:57.850 I CB-SDK: : login richa = {full_name: Android user, address_book_name: null, email: [email protected], login: Android, phone: 3011111111, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1692955993141409/1692955993141409.jpg, guest: null, timezone: null, tag_list: null, id: 10483824, created_at: null, updated_at: null} 15:03:57.850 I CB-SDK: CubeChatConnection: [login] userId: 10483824, resourceId: null 15:03:57.881 I CB-SDK: PushNotificationsManager: [getToken] token: caa0d8KrRvKu3_3ss8_9Qb:APA91bHVhn54Gdk4H62LV48kYsrnWxztUq0iAS8yuTpQGbNG0fX7NVQK2dR08I0AWyvRp3u2bGEjlqAkepDyOLzLWyHkASf6f_WISTi3bZH-nTmrqjtp-VAdC53Kxl4RAMPbESiG8ZyA 15:03:57.881 I CB-SDK: PushNotificationsManager: [subscribe] token: caa0d8KrRvKu3_3ss8_9Qb:APA91bHVhn54Gdk4H62LV48kYsrnWxztUq0iAS8yuTpQGbNG0fX7NVQK2dR08I0AWyvRp3u2bGEjlqAkepDyOLzLWyHkASf6f_WISTi3bZH-nTmrqjtp-VAdC53Kxl4RAMPbESiG8ZyA 15:03:57.881 I CB-SDK: PushNotificationsManager: [subscribe] token: caa0d8KrRvKu3_3ss8_9Qb:APA91bHVhn54Gdk4H62LV48kYsrnWxztUq0iAS8yuTpQGbNG0fX7NVQK2dR08I0AWyvRp3u2bGEjlqAkepDyOLzLWyHkASf6f_WISTi3bZH-nTmrqjtp-VAdC53Kxl4RAMPbESiG8ZyA 15:03:57.889 I CB-SDK: : ========================================================= 15:03:57.890 I {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.7.0, CB-Token: BB6A7DBBE3803E241269451ED4F91E358E42} 15:03:57.894 I CB-SDK: : ========================================================= 15:03:57.895 I {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.7.0, CB-Token: BB6A7DBBE3803E241269451ED4F91E358E42} 15:03:58.153 I CB-SDK: CubeChatConnection: Chat connection SocketOpened 15:03:58.821 I CB-SDK: : ********************************************************* 15:03:58.826 I CB-SDK: PushNotificationsManager: [subscribe] subscription ERROR: ResponseException: 403: {"errors":{"base":["Forbidden. Need user."]}} 15:03:58.925 I CB-SDK: CubeChatConnection: Chat connection Authenticated 15:03:58.962 I CB-SDK: : ********************************************************* 15:03:58.964 I CB-SDK: PushNotificationsManager: [subscribe] subscription ERROR: ResponseException: 403: {"errors":{"base":["Forbidden. Need user."]}} 15:04:00.411 I CB-SDK: CubeChatConnection: Chat connection SessionInitialized 15:04:01.194 I CB-SDK: CubeChatConnection: Chat connection Ready 15:04:01.195 I CB-SDK: : _goDialogScreen 15:05:27.211 I CB-SDK: : ========================================================= 15:05:27.211 I {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.7.0, CB-Token: BB6A7DBBE3803E241269451ED4F91E358E42} 15:05:27.212 I CB-SDK: : ========================================================= 15:05:27.213 I {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.7.0, CB-Token: BB6A7DBBE3803E241269451ED4F91E358E42} 15:05:27.257 I CB-SDK: : ========================================================= 15:05:27.258 I {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.7.0, CB-Token: BB6A7DBBE3803E241269451ED4F91E358E42} 15:05:28.186 I CB-SDK: : ********************************************************* 15:05:28.191 I CB-SDK: : GetDialog error ResponseException: 403: {"errors":{"base":["Forbidden. Need user."]}} 15:05:28.233 I CB-SDK: : ********************************************************* 15:05:28.234 I CB-SDK: : GetDialog error ResponseException: 403: {"errors":{"base":["Forbidden. Need user."]}} 15:05:28.319 I CB-SDK: : *********************************************************
I am getting Forbidden. Need user on signup, can u check the logs and let me know whats the wrong here
` //-------------------------------------------------------------------------------- // ConnectyCube /// Create Account of ConnectyCube user void _createAccountPressed( MutationSignupSetupStepThreesignupSetpThreedatauser? user) { DebugLog.d('connectycube create an user with $user'); final userToSignUp = CubeUser();
userToSignUp.password = AppConstant.chatPassword;
userToSignUp.login = firstNameController.text;
userToSignUp.phone = mobileController.text;
userToSignUp.email = emailAddressController.text;
userToSignUp.fullName =
"${firstNameController.text} ${lastNameController.text}";
if (user?.avatar != null &&
user?.file_path != null &&
user?.file_path != "") {
userToSignUp.avatar = "${user?.file_path}${"/"}${user?.avatar}";
} else {
userToSignUp.avatar = "";
}
mainController.connectyCubeService.signInCC(userToSignUp);
} `
`Future
isLoginContinues = true;
if (!CubeSessionManager.instance.isActiveSessionValid()) {
try {
await createSession();
} catch (error) {
_processLoginError(error);
}
}
try {
final newUser = await signUp(user);
user.id = newUser.id;
await SharedPref.saveNewUser(user, ChatLoginType.login);
PushNotificationsManager.instance.init();
_loginToCubeChat(user);
} catch (exception) {
_processLoginError(exception);
}
}`
can u tell me when i have to use below method ?
_loginToCCWithSavedUser(context, loginType ?? LoginType.login);
if (!CubeSessionManager.instance.isActiveSessionValid()) { try { await createSession(); } catch (error) { _processLoginError(error); } }
I think its not going into create session but i dont know reason as i have followed all code of urs
onSessionRestore:
I/flutter ( 1771): CB-SDK: : =========================================================
I/flutter ( 1771): === REQUEST ==== f22be1d1-6128-4f8a-b67e-934cbc859c09 ===
I/flutter ( 1771): REQUEST
I/flutter ( 1771): POST https://api.connectycube.com/session
I/flutter ( 1771): HEADERS
I/flutter ( 1771): {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.7.0, CB-Token: }
I/flutter ( 1771): BODY
I/flutter ( 1771): {"application_id":"7266","auth_key":"cKYHfvnvsHqX6JX","nonce":"1442505540","timestamp":"1692958190","signature":"58804d90c8868e37fda35bcfca793decfe637748"}
I/flutter ( 1771):
[log] ---Xmpp Sending:---
[log]
I/flutter ( 1771):
I/flutter ( 1771): CB-SDK: : *********************************************************
I/flutter ( 1771): *** RESPONSE *** 201 *** 3a0c9a63-26b3-4699-a3e7-5c705ad9f43b ***
I/flutter ( 1771): HEADERS
I/flutter ( 1771): {cb-token-expirationdate: 2023-08-25 12:09:51 UTC, connection: keep-alive, date: Fri, 25 Aug 2023 10:09:51 GMT, strict-transport-security: max-age=15768000; includeSubDomains, content-length: 227, access-control-expose-headers: CB-Token-ExpirationDate, Date, content-type: application/json; charset=utf-8, server: nginx/1.25.0}
I/flutter ( 1771): BODY
I/flutter ( 1771): {"session":{"created_at":"2023-08-25T10:09:51.851Z","updated_at":"2023-08-25T10:09:51.851Z","application_id":7266,"token":"F2223DAFE47F24114739AB02EE9667123EDC","nonce":1115830105,"ts":1692958190,"user_id":null,"id":905612109}}
I/flutter ( 1771):
I/flutter ( 1771): CB-SDK: : =========================================================
I/flutter ( 1771): === REQUEST ==== c46a0021-04f6-4737-aafa-160b470e3207 ===
I/flutter ( 1771): REQUEST
I/flutter ( 1771): GET https://api.connectycube.com/chat/Dialog
I/flutter ( 1771): HEADERS
I/flutter ( 1771): {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.7.0, CB-Token: F2223DAFE47F24114739AB02EE9667123EDC}
I/flutter ( 1771): BODY
I/flutter ( 1771):
I/flutter ( 1771):
I/flutter ( 1771): CB-SDK: : *********************************************************
I/flutter ( 1771): *** RESPONSE *** 201 *** 3f79f457-5dfc-4b43-83b4-5f429a4e552c ***
I/flutter ( 1771): HEADERS
I/flutter ( 1771): {cb-token-expirationdate: 2023-08-25 12:09:51 UTC, connection: keep-alive, date: Fri, 25 Aug 2023 10:09:51 GMT, strict-transport-security: max-age=15768000; includeSubDomains, content-length: 226, access-control-expose-headers: CB-Token-ExpirationDate, Date, content-type: application/json; charset=utf-8, server: nginx/1.25.0}
I/flutter ( 1771): BODY
I/flutter ( 1771): {"session":{"created_at":"2023-08-25T10:09:51.912Z","updated_at":"2023-08-25T10:09:51.912Z","application_id":7266,"token":"96A8D55E258D7E5A82977A0E8FF3B344E532","nonce":510672205,"ts":1692958190,"user_id":null,"id":787647583}}
I/flutter ( 1771):
I/flutter ( 1771): CB-SDK: : =========================================================
I/flutter ( 1771): === REQUEST ==== ba988ce9-c17f-4d84-9a9e-2c5150ccc5a0 ===
I/flutter ( 1771): REQUEST
I/flutter ( 1771): GET https://api.connectycube.com/chat/Message/unread
I/flutter ( 1771): HEADERS
I/flutter ( 1771): {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.7.0, CB-Token: 96A8D55E258D7E5A82977A0E8FF3B344E532}
I/flutter ( 1771): BODY
I/flutter ( 1771):
I/flutter ( 1771):
I/flutter ( 1771): CB-SDK: : *********************************************************
I/flutter ( 1771): *** RESPONSE *** 403 *** 440a2705-8796-4230-b657-1a5171bade4d ***
I/flutter ( 1771): HEADERS
I/flutter ( 1771): {connection: keep-alive, content-type: application/json; charset=utf-8, date: Fri, 25 Aug 2023 10:09:53 GMT, strict-transport-security: max-age=15768000; includeSubDomains, server: nginx/1.25.0, content-length: 45}
I/flutter ( 1771): BODY
I/flutter ( 1771): {"errors":{"base":["Forbidden. Need user."]}}
I/flutter ( 1771):
I/flutter ( 1771): CB-SDK: : GetDialog error ResponseException: 403: {"errors":{"base":["Forbidden. Need user."]}}
I/flutter ( 1771): CB-SDK: : *********************************************************
I/flutter ( 1771): *** RESPONSE *** 403 *** ba988ce9-c17f-4d84-9a9e-2c5150ccc5a0 ***
I/flutter ( 1771): HEADERS
I/flutter ( 1771): {connection: keep-alive, content-type: application/json; charset=utf-8, date: Fri, 25 Aug 2023 10:09:53 GMT, strict-transport-security: max-age=15768000; includeSubDomains, server: nginx/1.25.0, content-length: 45}
I/flutter ( 1771): BODY
I/flutter ( 1771): {"errors":{"base":["Forbidden. Need user."]}}
I/flutter ( 1771):
[GETX] Info: _GetImpl Instance of '_GetImpl' runZonedGuarded: ResponseException: 403: {"errors":{"base":["Forbidden. Need user."]}}
I/flutter ( 1771): CB-SDK: : *********************************************************
I/flutter ( 1771): *** RESPONSE *** 403 *** c46a0021-04f6-4737-aafa-160b470e3207 ***
I/flutter ( 1771): HEADERS
I/flutter ( 1771): {connection: keep-alive, content-type: application/json; charset=utf-8, date: Fri, 25 Aug 2023 10:09:53 GMT, strict-transport-security: max-age=15768000; includeSubDomains, server: nginx/1.25.0, content-length: 45}
I/flutter ( 1771): BODY
I/flutter ( 1771): {"errors":{"base":["Forbidden. Need user."]}}
I/flutter ( 1771):
I/flutter ( 1771): CB-SDK: : GetDialog error ResponseException: 403: {"errors":{"base":["Forbidden. Need user."]}}
I dont think its issue of session as its get created as per above log
the latest log is completely unreadable, but I tried...
According to the provided log, I can see that the session was created without the user. Let see step by step:
- You received the response with session creation with id
3a0c9a63-26b3-4699-a3e7-5c705ad9f43b
and this created session has tokenF2223DAFE47F24114739AB02EE9667123EDC
and"user_id":null
; - You use this token in the request for getting dialogs (request id is
c46a0021-04f6-4737-aafa-160b470e3207
); - You received the response on the request
c46a0021-04f6-4737-aafa-160b470e3207
with 403 error;
Please review your logic for the first signup into the app and the next app starts with saved user.
can u tell me when i have to use below method ?
_loginToCCWithSavedUser(context, loginType ?? LoginType.login);
can u tell me for this?
when you need to log in the the Connectycube with the saved before user, e.g. after restarting the app or etc.
`Future signInCC(CubeUser user, {bool isEmailSelected = false,bool isLoginContinues = false}) async { if (isLoginContinues) return;
i added signup logic , i can not find what is the wrong here. although when i do logout n login then its working fine, so
16:59:29.940 I CB-SDK: : *********************************************************
16:59:29.941 I *** RESPONSE *** 201 *** 30b038ab-07ba-4896-bc4b-e61de82c1cbb ***
16:59:29.941 I HEADERS
16:59:29.941 I {cb-token-expirationdate: 2023-08-25 13:29:29 UTC, connection: keep-alive, date: Fri, 25 Aug 2023 11:29:29 GMT, strict-transport-security: max-age=15768000; includeSubDomains, content-length: 397, access-control-expose-headers: CB-Token-ExpirationDate, Date, content-type: application/json; charset=utf-8, server: nginx/1.25.0}
16:59:29.941 I BODY
16:59:29.941 I {"user":{"_id":"64e89099303009002ea4ce86","id":10484542,"created_at":"2023-08-25T11:29:29Z","updated_at":"2023-08-25T11:29:29Z","login":"aaaaaaaa","full_name":"aaaaaaaa","last_request_at":null,"timezone":null,"email":null,"phone":null,"website":null,"twitter_id":null,"external_user_id":null,"facebook_id":null,"custom_data":null,"user_tags":null,"avatar":null,"external_id":null,"is_guest":null}}
16:59:29.941 I
16:59:29.949 I signUp newUser {full_name: aaaaaaaa, address_book_name: null, email: null, login: aaaaaaaa, phone: null, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: null, oldPassword: null, custom_data: null, avatar: null, guest: null, timezone: null, tag_list: null, id: 10484542, created_at: 2023-08-25T11:29:29.000Z, updated_at: 2023-08-25T11:29:29.000Z}
16:59:29.960 I CB-SDK: PushNotificationsManager: [init]
16:59:29.964 I CB-SDK: : =========================================================
16:59:29.964 I === REQUEST ==== 476c3d76-3ea0-400b-9fa1-c5ac9f606dfe ===
16:59:29.964 I REQUEST
16:59:29.964 I POST https://api.connectycube.com/login
16:59:29.964 I HEADERS
16:59:29.964 I {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.6.0, CB-Token: 0F4E084E5454976001D0D4B812874938FA20}
16:59:29.964 I BODY
16:59:29.964 I {"login":"aaaaaaaa","password":"123456"}
16:59:29.964 I
16:59:29.976 I CB-SDK: PushNotificationsManager: [getToken] token: fpoMrfW8S8a3bWH2auXmCm:APA91bHTfF9v9JGCGbJwZA3JgNS8M0fNfOSbiWh6fGjQDXz5b29k84Y_fNm-5fYyjI5KEsM5ulvTv7NXYa90LoGwpfRYwhTxreLOoX4TZd6cmN967B9HpzQH7ahHIL5Po8CaSCadhM9g
16:59:29.976 I CB-SDK: PushNotificationsManager: [subscribe] token: fpoMrfW8S8a3bWH2auXmCm:APA91bHTfF9v9JGCGbJwZA3JgNS8M0fNfOSbiWh6fGjQDXz5b29k84Y_fNm-5fYyjI5KEsM5ulvTv7NXYa90LoGwpfRYwhTxreLOoX4TZd6cmN967B9HpzQH7ahHIL5Po8CaSCadhM9g
16:59:30.013 I CB-SDK: : =========================================================
16:59:30.013 I === REQUEST ==== f4737e89-7522-40ef-a74c-2b95738d2e59 ===
16:59:30.013 I REQUEST
16:59:30.013 I POST https://api.connectycube.com/subscriptions
16:59:30.013 I HEADERS
16:59:30.013 I {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.6.0, CB-Token: 0F4E084E5454976001D0D4B812874938FA20}
16:59:30.013 I BODY
16:59:30.013 I {"notification_channel":"gcm","device":{"udid":"TP1A.220624.014","platform":"android"},"push_token":{"environment":"development","client_identification_sequence":"fpoMrfW8S8a3bWH2auXmCm:APA91bHTfF9v9JGCGbJwZA3JgNS8M0fNfOSbiWh6fGjQDXz5b29k84Y_fNm-5fYyjI5KEsM5ulvTv7NXYa90LoGwpfRYwhTxreLOoX4TZd6cmN967B9HpzQH7ahHIL5Po8CaSCadhM9g","bundle_identifier":"com.connectycube.flutter.chat_sample"}}
16:59:30.013 I
16:59:30.979 I CB-SDK: : *********************************************************
16:59:30.979 I *** RESPONSE *** 403 *** f4737e89-7522-40ef-a74c-2b95738d2e59 ***
16:59:30.979 I HEADERS
16:59:30.979 I {connection: keep-alive, content-type: application/json; charset=utf-8, date: Fri, 25 Aug 2023 11:29:30 GMT, strict-transport-security: max-age=15768000; includeSubDomains, server: nginx/1.25.0, content-length: 45}
16:59:30.979 I BODY
16:59:30.979 I {"errors":{"base":["Forbidden. Need user."]}}
16:59:30.979 I
16:59:30.982 I CB-SDK: PushNotificationsManager: [subscribe] subscription ERROR: ResponseException: 403: {"errors":{"base":["Forbidden. Need user."]}}
16:59:30.994 I CB-SDK: : *********************************************************
16:59:30.994 I *** RESPONSE *** 200 *** 476c3d76-3ea0-400b-9fa1-c5ac9f606dfe ***
16:59:30.994 I HEADERS
16:59:30.994 I {cb-token-expirationdate: 2023-08-25 13:29:30 UTC, connection: keep-alive, date: Fri, 25 Aug 2023 11:29:30 GMT, strict-transport-security: max-age=15768000; includeSubDomains, content-length: 397, access-control-expose-headers: CB-Token-ExpirationDate, Date, content-type: application/json; charset=utf-8, server: nginx/1.25.0}
16:59:30.994 I BODY
16:59:30.994 I {"user":{"_id":"64e89099303009002ea4ce86","id":10484542,"created_at":"2023-08-25T11:29:29Z","updated_at":"2023-08-25T11:29:29Z","login":"aaaaaaaa","full_name":"aaaaaaaa","last_request_at":null,"timezone":null,"email":null,"phone":null,"website":null,"twitter_id":null,"external_user_id":null,"facebook_id":null,"custom_data":null,"user_tags":null,"avatar":null,"external_id":null,"is_guest":null}}
16:59:30.994 I
16:59:30.999 I CB-SDK: : _loginToCubeChat user {full_name: aaaaaaaa, address_book_name: null, email: null, login: aaaaaaaa, phone: null, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: 123456, oldPassword: null, custom_data: null, avatar: null, guest: null, timezone: null, tag_list: null, id: 10484542, created_at: null, updated_at: null}
16:59:30.999 I CB-SDK: CubeChatConnection: [login] userId: 10484542, resourceId: null
16:59:31.003 I CB-SDK: CubeChatConnection: Chat connection SocketOpening
16:59:31.255 I CB-SDK: CubeChatConnection: Chat connection SocketOpened
16:59:32.696 I CB-SDK: CubeChatConnection: Chat connection Authenticated
16:59:35.452 I CB-SDK: CubeChatConnection: Chat connection SessionInitialized
16:59:36.988 I CB-SDK: CubeChatConnection: Chat connection Ready
16:59:36.989 I CB-SDK: : _goDialogScreen
16:59:36.990 I CB-SDK: : getNotificationAppLaunchDetails
16:59:36.990 I CB-SDK: : getNotificationAppLaunchDetails, payload: null
16:59:36.990 I CB-SDK: : getNotificationAppLaunchDetails, selectedDialogId: null
16:59:37.028 I CB-SDK: : =========================================================
16:59:37.028 I === REQUEST ==== fd2f6710-aa36-4921-8214-cf978f29a287 ===
16:59:37.028 I REQUEST
16:59:37.028 I GET https://api.connectycube.com/chat/Message/unread
16:59:37.028 I HEADERS
16:59:37.028 I {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.6.0, CB-Token: 0F4E084E5454976001D0D4B812874938FA20}
16:59:37.028 I BODY
16:59:37.028 I
16:59:37.028 I
16:59:37.029 I CB-SDK: : =========================================================
16:59:37.029 I === REQUEST ==== fc092355-95cb-4f71-86cd-ee765a010875 ===
16:59:37.029 I REQUEST
16:59:37.029 I GET https://api.connectycube.com/chat/Dialog
16:59:37.029 I HEADERS
16:59:37.029 I {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 2.6.0, CB-Token: 0F4E084E5454976001D0D4B812874938FA20}
16:59:37.029 I BODY
16:59:37.029 I
16:59:37.029 I
16:59:38.426 I CB-SDK: : *********************************************************
16:59:38.426 I *** RESPONSE *** 200 *** fc092355-95cb-4f71-86cd-ee765a010875 ***
16:59:38.426 I HEADERS
16:59:38.426 I {cb-token-expirationdate: 2023-08-25 13:29:38 UTC, connection: keep-alive, date: Fri, 25 Aug 2023 11:29:38 GMT, strict-transport-security: max-age=15768000; includeSubDomains, content-length: 51, access-control-expose-headers: CB-Token-ExpirationDate, Date, content-type: application/json; charset=utf-8, server: nginx/1.25.0}
16:59:38.426 I BODY
16:59:38.426 I {"total_entries":0,"skip":0,"limit":100,"items":[]}
16:59:38.426 I
16:59:38.427 I CB-SDK: _BodyLayoutState: getDialogs: {currentPage: null, totalEntries: 0, perPage: null, skip: 0, limit: 100, items: []}
16:59:38.430 I CB-SDK: : *********************************************************
16:59:38.430 I *** RESPONSE *** 200 *** fd2f6710-aa36-4921-8214-cf978f29a287 ***
16:59:38.430 I HEADERS
16:59:38.430 I {cb-token-expirationdate: 2023-08-25 13:29:38 UTC, connection: keep-alive, date: Fri, 25 Aug 2023 11:29:38 GMT, strict-transport-security: max-age=15768000; includeSubDomains, content-length: 11, access-control-expose-headers: CB-Token-ExpirationDate, Date, content-type: application/json; charset=utf-8, server: nginx/1.25.0}
16:59:38.430 I BODY
16:59:38.430 I {"total":0}
16:59:38.430 I
i have checked the logs of the demo of connectycube as well. same error coming in that also
please see the logs more carefully, Your request for subscription on the push notification (f4737e89-7522-40ef-a74c-2b95738d2e59) started before the response (476c3d76-3ea0-400b-9fa1-c5ac9f606dfe) for signin received
_signInCC(BuildContext context, CubeUser user) async { if (_isLoginContinues) return;
setState(() {
_isLoginContinues = true;
});
if (!CubeSessionManager.instance.isActiveSessionValid()) {
try {
await createSession();
} catch (error) {
_processLoginError(error);
}
}
signUp(user).then((newUser) {
print("signUp newUser $newUser");
user.id = newUser.id;
SharedPrefs.instance.saveNewUser(
user, isEmailSelected ? LoginType.email : LoginType.login);
PushNotificationsManager.instance.init();
signIn(user).then((result) {
_loginToCubeChat(context, user);
});
}).catchError((exception) {
_processLoginError(exception);
});
}
in ur demo its same
i have made some changes lets see
will check it later
You can try to move the string
PushNotificationsManager.instance.init();
after signIn(user).then((result) {
signUp(user).then((newUser) async{
log("signUp newUser $newUser");
user.id = newUser.id;
await SharedPref.saveNewUser(user, ChatLoginType.login);
signIn(user).then((result) {
PushNotificationsManager.instance.init();
_loginToCubeChat(user);
});
}).catchError((exception) {
_processLoginError(exception);
});
PLEASE UPDATE IN UR DEMO AS WELL. ISSUE RESOLVED. CLOSING THE TICKET. THANKS
I/flutter (28267): {"errors":{"base":["Forbidden. Need user."]}}
means that if you try to request dialogs using an empty session (without a user), you should call
signIn
before, or create the session with the user before calling this API.I/flutter (28267): {"type":3,"occupants_ids":[10023181]}
if you need to get all private dialogs for the current user you shouldn't set the current user id to the request, the server will return only user-related dialogs, and your user will not receive dialogs where it is not a member, please see our documentation
Check you set participant and login to the chat
means that your
CubeDialog
model should contain theoccupantsIds
with the actual opponents list and the user should login to the chat before using the chat functionality
hi @TatankaConCube , sometimes while chatting is going on in the app and suddently i get this message. "Check you set participant and login to the chat" , i guess session is getting expired at that time. but i have to restart the app for continuing the chat again. can u provide any status code with this error? so i can handle relogin while chatting ?
@TatankaConCube
CB-SDK: : Current app state: AppLifecycleState.resumed CB-SDK: : markActive richa = {full_name: Ria Patel, address_book_name: null, email: [email protected], login: Ria, phone: , website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: Brain@2023, oldPassword: null, custom_data: null, avatar: https://main-court-demo.s3.amazonaws.com/images/User, guest: null, timezone: null, tag_list: null, id: 10640992, created_at: null, updated_at: null}
if (user != null) {
if (!CubeChatConnection.instance.isAuthenticated()) {
if (ChatLoginType.phone == SharedPref.getChatLoginType() || ChatLoginType.login == SharedPref.getChatLoginType() ) {
if(CubeSessionManager.instance.isActiveSessionValid()){
user.password = CubeSessionManager.instance.activeSession?.token;
} else {
var phoneAuthSession = await createPhoneAuthSession();
user.password = phoneAuthSession.token;
log('phoneAuthSession.token = ${phoneAuthSession.token}');
}
}
log('login richa = $user');
CubeChatConnection.instance.login(user);
} else {
log('markActive richa = $user');
CubeChatConnection.instance.markActive();
}
}
CubeSessionManager.instance.isActiveSessionValid() is false so user has active session so why i am getting above error
CB-SDK: : onSendMessage message= {_id: 64fedda7930afe6a3b1f2386, chat_dialog_id: null, message: hi, date_sent: 1694424487, sender_id: null, recipient_id: null, read_ids: null, delivered_ids: null, views_count: null, attachments: null, reactions: null, id: null, created_at: null, updated_at: null} 14:58:07.482 I CB-SDK: : onSendMessage error= IllegalStateException: Check you set participant and login to the chat
you are a little bit mistaken, the state CubeSessionManager.instance.isActiveSessionValid()
is about the API session, but the error Check you set participant and login to the chat
can be related to the Chat connection. Use the next code snippet for validation of the chat connection:
if (CubeChatConnection.instance.currentUser != null &&
CubeChatConnection.instance.chatConnectionState ==
CubeChatConnectionState.Ready) {
}
@TatankaConCube , still getting same issue , i dont know why this error comes up suddenly in ongoing chat.
Current app state: AppLifecycleState.resumed
I/flutter (15691): CB-SDK: : markActive richa = {full_name: Bhumi Parikh, address_book_name: null, email: [email protected], login: Bhumi, phone: 9016121616, website: null, last_request_at: null, external_user_id: null, external_id: null, facebook_id: null, twitter_id: null, password: Brain@2023, oldPassword: null, custom_data: null, avatar: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1694007534109988/1694007534109988.png, guest: null, timezone: null, tag_list: null, id: 10551524, created_at: null, updated_at: null}
I/flutter (15691): CB-SDK: AsyncStanzaSender: getInstance
I/flutter (15691): CB-SDK: AsyncStanzaSender: add new task RMGRETLVT
I/flutter (15691): CB-SDK: AsyncStanzaSender: start timer RMGRETLVT
[log] ---Xmpp Sending:---
[log]
I provided the possible reasons for this error here. Can you reproduce this error on our Chat sample? Sorry, but we can't see your code and the log is filtered (without XMPP stanzas). We can't catch the reason for your case.
@TatankaConCube , ya i understand. when i login to the app it working fine so i am sure that login gets expired and i get this message. but why login gets expired suddently. and u guys are not handling this in a better way? ,
void onSendChatMessage(String content) { if (content.trim() != '') { final message = createCubeMsg(); message.body = content.trim(); onSendMessage(message); } else { showSnackBar(message: 'Nothing to send'); } }
/// On Send Message Update UI And Send Message to ConnectyCube void onSendMessage(CubeMessage message) async { log("onSendMessage message= $message"); commentController.clear(); await cubeDialog.sendMessage(message).then((value) { message.senderId = cubeUser.id; addMessageToListView(message); listScrollController.animateTo(0.0, duration: const Duration(milliseconds: 300), curve: Curves.easeOut); if (cubeDialog.type == CubeDialogType.PRIVATE) { ChatManager.instance.sentMessagesController .add(message..dialogId = cubeDialog.dialogId); } }).onError((error, stackTrace) { log("onSendMessage error= $error"); showSnackBar(message: "Error: $error"); });
}
this is my code of send message
createCubeMsg() is not giving me other data
because my dialog also has all data as below
{_id: 64fb1f10bc7b59002f7ea144, last_message: hiii, last_message_date_sent: 1694687832, last_message_user_id: 10551474, photo: https://main-court-demo122136-dev.s3.amazonaws.com/public/User/1693305744031191/1693305744031191.jpg, user_id: 10551524, xmpp_room_jid: null, unread_messages_count: 1, name: Richa Shah, type: 3, description: null, occupants_count: 2, occupants_ids: [10551474, 10551524], pinned_messages_ids: [], admins_ids: [], data: null, last_message_status: null, last_message_id: 6502e24cad7e27f3f104b61a, is_e2ee: false, is_muted: false, id: null, created_at: 2023-09-08T13:18:08.000Z, updated_at: 2023-09-14T10:37:12.000Z}
this is the data createcubemsg giving me
{_id: 6502f13c8a1272373f06b5d2, chat_dialog_id: null, message: null, date_sent: 0, sender_id: null, recipient_id: null, read_ids: null, delivered_ids: null, views_count: null, attachments: null, reactions: null, id: null, created_at: null, updated_at: null}
i am sure that login gets expired
no, the chat connection doesn't have limits for a lifetime. use this listener for listening the chat connection state changes