Account Creation + How to get User and Account Info
This guide provides an example of how an account can be created by pulling property and user information from the Cloudbeds account.
Read our User Authorization Flow Optionsarticle to see the diagrams of 2 different user flows, one starting in your account and one starting in Cloudbeds Marketplace.
Cloudbeds API doesn't support the classic SSO. You may create an account, but you still need to provide the users with the login credentials (username and password).
1. Start the account creation
In Cloudbeds Marketplace app page, user clicks "Connect App".
This redirects the user to the Authorization page. User clicks "Approve" which initiates the Authentication
flow.
2. Get the user and account info
Your app completes the authentication and you retrieve the API key or access token.
Your app uses userinfo to see the details of the user that approved the connection.
With the API key or access token, your app polls getHotelDetails to see the details of the property account.
You can use getHotelsto see details of accounts that belong to a group (read more in Supporting Group Accounts
You can use getUsers to see all users in the Cloudbeds account.
3. Existing vs. new account
In your app, the UI user is presented with the option to proceed to create a new account or log into an existing account.
- If the user chooses to create a new account, your App checks the value in the response field "propertyID" against the Cloudbeds Property IDs (PIDs) already associated with accounts in your system
- If the Cloudbeds PID matches, then API session is linked by your App to the existing account in your system
- If the PID does not match, then a new account is created using the full details included in getHotelDetails and the session is linked to that. User should have the ability to access their username and reset the password for your App account.
- If the user selects the option to log in to an existing account the API session is linked to that account after successful login.
4. Group account support
Account creation only works for group properties if your app also supports group properties. In this case your app has to send a propertyID parameter with each call and postAppState for each property listed in getHotels (read more in Supporting Group Accounts
If your app supports only single property accounts please ask us to disable group support for you.
Updated about 1 month ago