<commit_before># Generic OAuth2 Examples

The [OAuth2](oauth2) connection gives you the ability to support any OAuth2 provider in addition to the ones that are availble in the dashboard.

Here are a few examples of OAuth2 connections you can create through the API. Save these snippets to a file (sample-connection.json) and then use cURL to call the API:

```
curl -vX POST https://@@account.namespace@@/api/connections -H "Content-Type: application/json" -H 'Authorization: Bearer {YOUR_GLOBAL_CLIENT_ACCESS_TOKEN}' -d @sample-connection.json
```

After the call completes successfully, you will be able to login using these new providers.

## Dropbox

* [Create an application](https://www.dropbox.com/developers/apps/create)* Set `Redirect URI` to [https://@@account.namespace@@/login/callback](https://@@account.namespace@@/login/callback).
* Copy `App Key` and `App Secret`:

```
{
  "name": "dropbox",
  "strategy": "oauth2",
  "options": {
    "client_id": "{YOUR_DROPBOX_APP_KEY}",
    "client_secret": "{YOUR_DROPBOX_APP_SECRET}",
    "authorizationURL": "https://www.dropbox.com/1/oauth2/authorize",
    "tokenURL": "https://api.dropbox.com/1/oauth2/token",
    "scope": [],
    "scripts": {
      "fetchUserProfile": "function(accessToken,ctx,cb){request.get('https://api.dropbox.com/1/account/info',{headers:{'Authorization':'Bearer '+accessToken}},function(e,r,b){if(e) return cb(e);if(r.statusCode!==200) return cb(new Error('StatusCode: '+r.statusCode));var profile=JSON.parse(b);cb(null,{user_id:profile.uid,family_name:profile.name_details.surname,given_name:profile.name_details.given_name,email:profile.email,email_verified:profile.email_verified,locale:profile.locale,is_paired:profile.is_paired,country:profile.country,dropbox_team:profile.team,dropbox_referral_link:profile.referral_link});});}"
    }
  }
}
```

##Uber

* [Create an application](https://developer.uber.com/apps/new) 
* Set the `Redirect URI` to [https://@@account.namespace@@/login/callback](https://@@account.namespace@@/login/callback).
* Copy `Client ID` and `Secret` to config file below

```<commit_msg>Styling fixed<commit_after># Generic OAuth2 Examples

The [OAuth2](oauth2) connection gives you the ability to support any OAuth2 provider in addition to the ones that are availble in the dashboard.

Here are a few examples of OAuth2 connections you can create through the API. Save these snippets to a file (sample-connection.json) and then use cURL to call the API:

```
curl -vX POST https://@@account.namespace@@/api/connections -H "Content-Type: application/json" -H 'Authorization: Bearer {YOUR_GLOBAL_CLIENT_ACCESS_TOKEN}' -d @sample-connection.json
```

After the call completes successfully, you will be able to login using these new providers.

## Dropbox

* [Create an application](https://www.dropbox.com/developers/apps/create)
* Set `Redirect URI` to [https://@@account.namespace@@/login/callback](https://@@account.namespace@@/login/callback).
* Copy `App Key` and `App Secret`:

```
{
  "name": "dropbox",
  "strategy": "oauth2",
  "options": {
    "client_id": "{YOUR_DROPBOX_APP_KEY}",
    "client_secret": "{YOUR_DROPBOX_APP_SECRET}",
    "authorizationURL": "https://www.dropbox.com/1/oauth2/authorize",
    "tokenURL": "https://api.dropbox.com/1/oauth2/token",
    "scope": [],
    "scripts": {
      "fetchUserProfile": "function(accessToken,ctx,cb){request.get('https://api.dropbox.com/1/account/info',{headers:{'Authorization':'Bearer '+accessToken}},function(e,r,b){if(e) return cb(e);if(r.statusCode!==200) return cb(new Error('StatusCode: '+r.statusCode));var profile=JSON.parse(b);cb(null,{user_id:profile.uid,family_name:profile.name_details.surname,given_name:profile.name_details.given_name,email:profile.email,email_verified:profile.email_verified,locale:profile.locale,is_paired:profile.is_paired,country:profile.country,dropbox_team:profile.team,dropbox_referral_link:profile.referral_link});});}"
    }
  }
}
```

##Uber

* [Create an application](https://developer.uber.com/apps/new) 
* Set the `Redirect URI` to [https://@@account.namespace@@/login/callback](https://@@account.namespace@@/login/callback).
* Copy `Client ID` and `Secret` to config file below

```
{'fraction_non_alphanumeric': 0.16003810431055013, 'fraction_numerical': 0.006668254346272922, 'mean_word_length': 5.896551724137931, 'pattern_counts': {'":': 20, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 20, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2712586', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1354, 'n_words': 287}