[#956] I can't get user token by getUserToken method

Migrated from Redmine #956 | Author: Артур Чернієвич
Status: New | Priority: High, I’m very impatient | Created: 2022-11-07


When I want to book service I got error: “Client authorization required”.
I created a test client but can’t get user token. I got this error: “RPC Exception: -32000 Unexpected error”.
I can get token only if I set companyid and api key.

API explorer - Even if you set self companyLogin and APIkey then we can’t make a book with correct user. API documentation | SimplyBook.me Online Scheduling

Please help, I don’t have time to wait

Артур Чернієвич wrote:

Please help me with this issue.
When I want to book service I get error: “Client authorization required”. But I created a test user and use his data for a booking. It didn’t help me.

API explorer - Even if you set self companyLogin and APIkey then we can’t make a book with correct user. API documentation | SimplyBook.me Online Scheduling

Redmine Admin wrote:

please provide your raw http request

Артур Чернієвич wrote:

Redmine Admin wrote:

please provide your raw http request

{“jsonrpc”:“2.0”,“method”:“book”,“params”:[“2”,“1”,“2022-11-08”,“18:00:00”,{“name":“Art”,“email”:"acernievic1@gmail.com”,“phone”:“+380684188238”},“[{id: 1, name: 2f95144d2d212b8218ad695390949618, title: Take a shower please, type: checkbox, length: null, values: null, default: , is_null: null, is_visible: 1, pos: 1, show_for_all_events: null, add_to_invoice: null, value: null, plugin_event_field_value_id: null}]”],“id”:1063830952}

Артур Чернієвич wrote:

RPC Exception: -32068 Client authorization required

I’m getting this error even though I have registered the client in the service

Redmine Admin wrote:

Did you enable client login plugin?

Артур Чернієвич wrote:

Redmine Admin wrote:

Did you enable client login plugin?

Yes of course. It didin’t help me.

Redmine Admin wrote:

if it is enabled then you need to use admin API to book

Артур Чернієвич wrote:

I can’t tell that the problem is in my code. Since I entered the company login and APi in the API Explorer and there I also received an error when booking: “Client authorization required”

Redmine Admin wrote:

which is correct in your case. Please disable client loin plugin, then API explorer will work

Артур Чернієвич wrote:

Redmine Admin wrote:

if it is enabled then you need to use admin API to book

No, that’s a bad idea. I need to do this via jsonRPC

Артур Чернієвич wrote:

Redmine Admin wrote:

which is correct in your case. Please disable client loin plugin, then API explorer will work

You are right. I disabled client login plugin and it’s works for API explorer and for my code. Thank you very much!