# Cloud providers

The kepler.gl application does not have a backend, however it offers integration point for optional commercial backends. Each backend can integrate with kepler by adding a "cloud provider" object to kepler's global list of cloud providers.

These objects must implement certain minimal set of methods, and can optionally implement others, depending on the capability of the backend.

The set of methods available for cloud providers to implement is subject to change as new features are added to the front-end.

## Cloud Provider Object

A "cloud provider" object provides:

* a name and an icon
* any service specific methods (such as `uploadFile`)
* a set of oauth2 methods to plug into the authentication flow and get access tokens

Cloud-providers providers can implement the following properties

| Field/method        | Description                                                          | Required? |
| ------------------- | -------------------------------------------------------------------- | --------- |
| `name`              | Name of the provider                                                 | required  |
| `displayName`       | Display name                                                         |           |
| `icon`              | React Element to render as Icon                                      |           |
| `thumbnail`         | Size of the thumbnail image of the map that required by the provider |           |
| `hasPrivateStorage` | To participate in kepler's build-in private map saving function      | required  |
| `hasSharingUrl`     | To participate in kepler's build-in share map via URL function       | required  |
| `getShareUrl`       | To show user the shared Url of the map                               |           |
| `getMapUrl`         | To update browser location once a map has been saved / loaded        |           |
| `getAccessToken`    | To participate in kepler's built-in oauth login routes               |           |
| `getUserName`       | To display user name of the logged in user                           |           |
| `login`             | Method called to perform user login                                  | required  |
| `logout`            | Method called to logout an user                                      | required  |
| `uploadMap`         | Method called to upload map to storage                               | required  |
| `listMaps`          | Method called to load a catalog of maps saved by the current user    | required  |
| `downloadMap`       | Method called to download a specific map                             | required  |

## Adding a new Cloud Provider

An instance of the provider is added to array of cloud providers in the file `src/cloud-providers/providers.js` then passed to kepler.gl demo app. An example provider: [Dropbox Provider](https://github.com/keplergl/kepler.gl/blob/master/examples/demo-app/src/cloud-providers/dropbox-provider.js)

```js
import {Provider} from '@kepler.gl/cloud-providers';

class MyProvider extends Provider {
    constructor() {
        this.name = 'foo';
        this.displayName = 'My Provider';
    }

    // ... other required methods below
}

const myProvider = new MyProvider();
const App = () =>
    <KeplerGl
        mapboxApiAccessToken={CLOUD_PROVIDERS_CONFIGURATION.MAPBOX_TOKEN}
        id="map"
        cloudProviders={[myProvider]}
    />
```

## Cloud Provider Instance Fields and Methods

See [Cloud Provider API](/docs/api-reference/cloud-providers/cloud-provider.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kepler.gl/docs/api-reference/cloud-providers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
