pusher / chatkit-android

Android client SDK for Pusher Chatkit
https://pusher.com/chatkit
MIT License
53 stars 14 forks source link

How to create new users from chatkit-android sdk? #70

Closed mayuroks closed 5 years ago

mayuroks commented 6 years ago

How to create new users from chatkit-android sdk?

I am able to create new users by logging into the admin panel and creating new users manually. But I want to create a chat app, where user's can simply download my app, login via Google and the user is automatically created without anyone accessing the admin panel.

Kindly share an example that achieves this.

KingIdee commented 6 years ago

I don't think you can do this in the Android client yet. You can use one of the server SDKs to aid this. For instance, in Node.js, you can do something like this:

app.post('/user', (req, res) => {
  chatkit.createUser({
  id: req.body.email,
  name: req.body.name,
  avatarURL: req.body.imageURL
  }).then(r => {
    res.send(r);
  }).catch((err) => {
    res.send(err);
  });

});
mdpye commented 5 years ago

This can't be done from the client SDKs yet becuase there is no end-user permission for it. Only tokens with the su claim set can create users, and they should never be distributed to end-users because theu can do anything, including impersonating any user.