5

I'm using Sinch SDK for instant messaging. How to logout user? I have button to logout user, but can't implement that feature in Sinch SDK. Neither their docs or samples describe such feature.

Michał Tajchert
  • 10,333
  • 4
  • 30
  • 47

1 Answers1

6

The sinch client does not have a logout, we consider mobile users to be "online" what you can do if you i.e don't want to receive more push messages is to unregister push data, and if you are not using push, just stop the client. We are using delegated security so if you tell us Joe is logged in with you key and secret we trust that you have verified the user.

cjensen
  • 2,703
  • 1
  • 16
  • 15
  • Uh, that is a bummer, if you consider scenario when user wants to switch accounts or just log out. You need to: sinchClient.stopListeningOnActiveConnection(); sinchClient.unregisterPushNotificationData(); sinchClient.unregisterManagedPush(); And hope not to overlook anything and then reanable connection as new user. Could be easier. – Michał Tajchert Jul 20 '15 at 16:45
  • Yeah, We know. But in order to make it easy for the majority of the usescases where you have only one account we took that approach that you are actually always reachable. – cjensen Jul 22 '15 at 15:39
  • Hmm to be honest it is hard to find app that doesn't allow user to logout, even messaging ones. – Michał Tajchert Jul 22 '15 at 19:21
  • Well, but when you log out, if its going to be worth something you should "delete" the data. And then it synced again. Right? if you look at messenger or something you would be very suprised if you did not have your message history. – cjensen Jul 24 '15 at 21:30
  • But I will take your suggestions to the team ;) – cjensen Jul 24 '15 at 21:31
  • @cjensen For now I'll have to write a custom log out function, but It would be very useful to have one built into Sinch... I hope the function will log the user out, and optionally invalidate their session and remove any instances of sinchClient which remain. – Will Brickner Aug 07 '15 at 21:04
  • I hear you, in the SinchService for ios we added something like that. We'll see if we do something similar for android, https://github.com/sinch/SinchService-iOS – cjensen Aug 07 '15 at 22:38
  • 1
    this is poor thing that user can not switch from the same app. I also need that logout feature for switching one to another user. but that wont work – Nitin Gohel Jul 13 '16 at 11:05