This guide provides an example on how an account can be created by pulling property and user information from the Cloudbeds account.
Read our User Authorization Flow Options article 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).
OAuth URL should only be used for initial authorization. Next time the user logs in they should use your login URL.
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 OAuth flow.
2. Get the user and account info
Your app completes OAuth flow and receives access token.
Your app uses userinfo to see the details of the user that approved the connection.
With access token, your app polls getHotelDetails to see the details of the property account.
You can use getUsers to see all users in the Cloudbeds account.
3. Existing vs. new account
In your app UI user is presented with option to proceed to create a new account or log into existing account.
- If user chooses to create a new account, your App checks the integer in the response field "propertyID" against the Cloudbeds Property IDs (PIDs) already associated with accounts in their system
- If the Cloudbeds PID matches, then API session is linked by your App to the existing account in their system
- If 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 user selects the option to log in to 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 Group Account Support).
If your app supports only single property accounts please ask us to disable group support for you.