Authentication (OAuth 2.0)
When your app wants to work with our API, it needs to be authenticated. We’ve made this easy with an OAuth 2.0 flow, so you don’t need to exchange API keys with the campsite.
Auth token
Section titled “Auth token”Every widget and your app’s default page receive an ?authtoken=.... parameter. You exchange this auth token for an idToken and a refreshToken.
Example request
curl --location --request POST 'https://api.camping.care/v21/oauth/token' \--form 'auth_token="..."'Example response
{ "kind":"identitytoolkit#VerifyCustomTokenResponse", "idToken":"....JWTidToken", "refreshToken":"....RefreshToken", "expiresIn":"3600", "isNewUser":false}API request
Section titled “API request”You can now use the idToken to call the API by sending it as a Bearer token. The request below gets the data of the user who is logged in via OAuth 2.0.
Example request
curl --location --request GET 'https://api.camping.care/v21/users/me' \ -H "Accept: application/json" \ -H "Authorization: Bearer {idToken}" \ -H "x-admin-id: {adminId}"Refresh your idToken
Section titled “Refresh your idToken”Every JWT idToken is valid for one hour (3600 seconds). When it expires, use the refresh token endpoint to get a new idToken you can use to authenticate with the API.
Example request
curl --location --request POST 'https://api.camping.care/v21/oauth/refresh_token' \--form 'refresh_token="..."'Example response
{ "access_token":"...AccessToken", "expires_in":"3600", "token_type":"Bearer", "refresh_token":"...reFreshToken", "id_token":"....idToken", "user_id":"...userUid"}