[#677] API Auth Issue

Migrated from Redmine #677 | Author: Michelle Thomas
Status: New | Priority: High, I’m very impatient | Created: 2021-03-29


Hi,

Can we get auth token for admin login using API key? The only example for admin auth in the docs use login and password which we don’t want to use.

We are vip customer, does that change api url that we use?

Below is the code we intend to replace with API Key

POST https://user-api-v2.simplybook.me/admin/auth
Content-Type: application/json

{
  "company": "",
  "login": "",
  "password": ""
}

Michelle Thomas wrote:

Noting that our booking page is michaelhillau.simplybook.vip and NOT michaelhillau.simplybook.me - therefore, should we be using a different API URL at all?
Our previous ticket didn’t receive suitable support and was closed prior to a resolution on our side, so we have had to create a new ticket to get this resolved quicker. I have also advised our success manager, Alex, of this issue ticket. Thanks

Dmytro Bondarev wrote:

There is no way to get token using API key.
You have to use user credentials.

Michelle Thomas wrote:

Dmitry Bondarev wrote:

There is no way to get token using API key.
You have to use user credentials.

Hi Dmitry,

We created additional user with admin role and tried to use above method to get auth key. We are getting below error

Ouch!

ERROR
I’m sorry, that page is in another universe!

Our booking page is michaelhillau.simplybook.vip - does it change the api url we have to use?

Does additional user with Admin role can access admin api?

Thanks

Michelle Thomas wrote:

Michelle Thomas wrote:

Dmitry Bondarev wrote:

There is no way to get token using API key.
You have to use user credentials.

Hi Dmitry,

We created additional user with admin role and tried to use above method to get auth key. We are getting below error

Further to this.

We tried to get Auth Token using api url https://user-api-v2.simplybook.vip/admin/auth and got success.

But, we are still facing issues with below command

POST - https://user-api-v2.simplybook.vip/admin/bookings

X-Company-Login - mixxxxxxxu
X-Token - Token

I’m getting Unauthorized 401 error

Redmine Admin wrote:

please make sure this user have access to view bookings

Dmytro Bondarev wrote:

Please provide HTTP request. Please note that you should use POST to make booking and GET to get bookings.

Michelle Thomas wrote:

Dmitry Bondarev wrote:

Please provide HTTP request. Please note that you should use POST to make booking and GET to get bookings.

We are still receiving Unauthorised error

HTTP Request

Get Auth Token

POST https://user-api-v2.simplybook.vip/admin/auth
Content-Type: application/json

{
“company”: “michaelhillqld”,
“login”: “username”,
“password”: “password”
}

Get bookings

GET https://user-api-v2.simplybook.vip/admin/bookings
Content-Type: application/json
X-Company-Login: michaelhillqld
X-Token: tokenfromauthrequest

Unauthorised error

I have seen working example using same code but none of those use .vip.
Can you please double check on this?

Dmytro Bondarev wrote:

Hi! I have checked it works fine.
And it looks like you are calling logout method somewhere, in this case token will not be valid anymore and you will get 401 error.

Michelle Thomas wrote:

Dmitry Bondarev wrote:

Hi! I have checked it works fine.
And it looks like you are calling logout method somewhere, in this case token will not be valid anymore and you will get 401 error.

Thanks Dmitry,

We can import data from Apis now. Thanks for all your help