# Auth0

### **Social Connection Integration**

When adding a Social Connection, you will see BitBadges as a preconfigured option. This has everything setup for you. You will simply need to specify your client ID and client secret. You will also have to configure your redirect URI to match your Auth0 application's domain. This typically ends with /callback (for example, <https://dev-pgv803tz4ztg35oi.us.auth0.com/login/callback>).

### <https://marketplace.auth0.com/integrations/bitbadges>

<figure><img src="/files/UiRYzMz0ybypjaqFbFme" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/mwUU3GAkOAp0GPOqLr1X" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/sYir8EFS1gxOtQd1wrQ1" alt=""><figcaption></figcaption></figure>

### Custom

You can also customize the connection further by creating a custom connection. This allows you to add parameters beyond the standard flow. You callback will be the same as above.

<figure><img src="/files/PDTgHryaB41SYA2LbBo1" alt=""><figcaption></figcaption></figure>

**Authorization URL:** <https://bitbadges.io/siwbb/authorize>

**Token URL:** <https://api.bitbadges.io/api/v0/siwbb/token>

**Scopes:** None (All you typically need is the user crypto address) - Although, you can add as needed

**Fields:** Get your API key, client ID, and client secret at <https://bitbadgesio/developer>.

**Fetch Profile Script**:

```javascript
function fetchUserProfile(accessToken, ctx, cb) {
    request.post(
        {
            url: 'https://api.bitbadges.io/api/v0/auth/status',
            headers: {
                'Content-Type': 'application/json',
                // TODO: Replace
                'x-api-key': 'ENTER_API_KEY_HERE',
                Authorization: 'Bearer ' + accessToken,
            },
        },
        (err, resp, body) => {
            if (err) {
                return cb(err);
            }
            if (resp.statusCode !== 200) {
                return cb(new Error(body));
            }
            let bodyParsed;
            try {
                bodyParsed = JSON.parse(body);
            } catch (jsonError) {
                return cb(
                    new Error('Failed JSON parsing for user profile response.')
                );
            }

            const account = bodyParsed;

            const profile = {
                address: account.address,
                chain: account.chain,
                id: account.bitbadgesAddress,
                name: account.address,
            };
            return cb(null, profile);
        }
    );
}
```

**Custom Headers:**

Make sure you enter your API key in the custom headers an d replace it in the fetch script.

```
{
    "x-api-key": "YOUR_API_KEY"
}
```


---

# 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.bitbadges.io/for-developers/bitbadges-api/sign-in-with-bitbadges/templates-and-frameworks/auth0.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.
