[#606] Cannot call getUserToken, received an error message: You are not allowed to use this application when HIPAA Plugin is enabled

Migrated from Redmine #606 | Author: Cho Optical
Status: Closed | Priority: High, I’m very impatient | Created: 2020-11-16


hi,

When I call getUserToken, then I received an error message: You are not allowed to use this application when HIPAA Plugin is enabled. I enabled HIPAA for setting session timeout, and I have a program to retrieve booking list by using simplybook API. Please help.

Cho Optical wrote:

hi,

When I call getUserToken, then I received an error message: You are not allowed to use this application when HIPAA Plugin is enabled. I enabled HIPAA for setting session timeout, and I have a program to retrieve booking list by using simplybook API. how to set session time out and also need to use API for getBookings? Please help. Thanks!

Dmytro Bondarev wrote:

Hi. You have to use rest API to get token with 2FA or with HIPAA enabled.

Cho Optical wrote:

Dmitry Bondarev wrote:

Hi. You have to use rest API to get token with 2FA or with HIPAA enabled.
API documentation | SimplyBook.me Online Scheduling
API documentation | SimplyBook.me Online Scheduling

Thanks for your reply.

I think the only way to do 2fa is using “/admin/auth/sms” to get SMS code for “/admin/auth/2fa” right?

Second question is when I call “/admin/auth/sms” by below URL then I get 404 “HIPAA is disabled”, but HIPAA has been enabled. please help

https://user-api-v2.simplybook.me/admin/auth/sms?company=optical88&session_id=WYl4A6sU2LGH0OFhHKJ41wXtYIdZbLoatALyEoVMZlE=

Dmytro Bondarev wrote:

You can use Google Authenticator. It depends what you have set up.

Cho Optical wrote:

Dmitry Bondarev wrote:

You can use Google Authenticator. It depends what you have set up.

but if I use SMS, I call “/admin/auth/sms” by below URL then I get 404 “HIPAA is disabled”, but HIPAA has been enabled. please help

https://user-api-v2.simplybook.me/admin/auth/sms?company=optical88&session_id=WYl4A6sU2LGH0OFhHKJ41wXtYIdZbLoatALyEoVMZlE=

Dmytro Bondarev wrote:

The phone number inserted for this user must be validated.

Cho Optical wrote:

Dmitry Bondarev wrote:

The phone number inserted for this user must be validated.

OK, I did, but got " “message”: “Too many attempts please try later.”,", how long it locked? and how many try is allowed before lock?

Thanks

Dmytro Bondarev wrote:

Try again after 30 minutes.

Cho Optical wrote:

Dmitry Bondarev wrote:

Try again after 30 minutes.

Now session is unlocked, but used by updated URL then got blank result but Status 200, please help
https://user-api-v2.simplybook.me/admin/auth/sms?company=optical88&session_id=pI665//zUqt/Tsgzaa5kxlYIXtphjBrXuwcH4mbguEo=

Dmytro Bondarev wrote:

Yes,
now you will get SMS to your phone. You have to use this code in 2fa step.
You can setup GA and generate code on server.

Cho Optical wrote:

Dmitry Bondarev wrote:

Yes,
now you will get SMS to your phone. You have to use this code in 2fa step.
You can setup GA and generate code on server.

But what I want to do, is coding a program to get a token then call getBookings, so that I need my program to get SMS and get token by 2fa, so is there any program way to get the SMS code? Thx

Dmytro Bondarev wrote:

We do not have such program. It is 2FA and you have to insert code from SMS.
The second - solution connect Google Authenticator and generate code on server side.

Cho Optical wrote:

Dmitry Bondarev wrote:

We do not have such program. It is 2FA and you have to insert code from SMS.
The second - solution connect Google Authenticator and generate code on server side.

OK, Thanks for your help. One more question, once I got a token from 2fa, when the token will be expired?

Dmytro Bondarev wrote:

it depends on HIPAA settings. https://help.simplybook.me/images/4/4e/Hipaa_settings_path_new_cf.png . It will expire after Timeout.
If you do not use HIPAA it will be active for 1hr. and then you will be able to get new by refresh token.

Cho Optical wrote:

Dmitry Bondarev wrote:

it depends on HIPAA settings. https://help.simplybook.me/images/4/4e/Hipaa_settings_path_new_cf.png . It will expire after Timeout.
If you do not use HIPAA it will be active for 1hr. and then you will be able to get new by refresh token.

Noted and Thank you so much for your help.

Leo Dimacuha wrote:

Dmitry Bondarev wrote:

Yes,
now you will get SMS to your phone. You have to use this code in 2fa step.
You can setup GA and generate code on server.

Hi! I have a similar issue. Can you kindly let me a bit more details on how to generate code on server? Any npm package I can use? Thank you!

Dmytro Bondarev wrote:

Hi,
You just need to make REST API calls, so you can use any HTTP client for this.
Please use URLs described above and if you have any issues, let us know.

Leo Dimacuha wrote:

Hi Dmitry, thank you for the quick response. I am already using REST API calls.

How can I get the ‘code’ to be used in the body here.

My REST call is this:

return axios.post(`${BASE_URL_REST}/admin/auth/2fa`, {
  company: COMPANY_LOGIN,
  session_id: sessionId,
  code: 'ga-code-here',       <-- how can i get the code to assign here?
  type: 'ga',
}, {

I am following the example from [[API documentation | SimplyBook.me Online Scheduling]]:

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

{
“company”: “”,
“session_id”: “”,
“code”: “<insert 2FA code>”,
“type”: “<insert 2FA type (ga/sms)>”
}

Dmytro Bondarev wrote:

Type is ga, so this is code from your Google Authenticator app.