Update LoggedinUser without apiKey

For security reasons we do not want to use the apiKey in the JavaScript. However according to the documentation you need the apiKey in order to update a user (https://prodocs.cometchat.com/docs/js-users-user-management).

Does someone know if it is possible to update the loggedInUser without the apiKey?

BTW, I tried passing the authToken instead of the apiKey, but that doesn’t work unfortunatly.

Hello @Thijs,

Ideally, the operation like creating or updating users require a AUTH KEY and cannot be done using an AuthToken. However, we do not encourage using AUTH KEY in your app. It is just an option that we provide and is not the best way to proceed. I would advise you to make a server to server call to create/update a user. You can follow our REST API documentation here. I hope this resolves your confusion.

Warm Regards,

CometChat Pro
Mayur Bhandari

Hello @Thijs,
There are two types of keys:

Rest API Key: API Key with full access.

Auth Key: API Key with auth only scope.

Auth Key can be used to login, create & update users. For everything else you need to use the Rest API Key.

Warm Regards,

CometChat Pro
Mayur Bhandari

@mayur.bhandari thanks for your answer.

For our application it would be very helpful if a user can update his own profile directly in the Frontend. So could you turn this issue into a feature request?

Hello @Thijs,

We have created a feature request for this and have added you to the feature request. We will keep you updated on progress. We will also notify you once this feature is live via email.

Warm Regards,

CometChat Pro
Mayur Bhandari

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.