Skip to content

Getting Started

This guide will help you set up and start using the Fanbase API in a few steps.

Prerequisites

  • Access credentials provided by Fanbase (client_id and client_secret)
  • A redirect URI configured and agreed with Fanbase (only for SSO authentication)
  • Development environment configured to make HTTP requests

Step 1: Get Credentials

Contact the Fanbase team to obtain your authentication credentials:

  • client_id: Public identifier for your client
  • client_secret: Secret that must be kept confidential

Step 2: Choose Integration Type

Fanbase offers different types of integration:

SSO Authentication (Single Sign-On)

For user authentication through OAuth 2.0 flow:

  1. Configure the redirect URI with Fanbase
  2. Implement the authorization flow
  3. Use Security endpoints to get user information

Connect Integrations

For integrations and data processing:

  1. Get token using client_credentials
  2. Use Connect API endpoints
  3. Process data through queues or direct integrations

Fanmarket

For integration with delivery services:

  1. Configure Melhor Envio integration
  2. Use freight calculation and management services

Step 3: Configure Redirect URI (Only for SSO)

If you will use SSO authentication, define together with Fanbase what your redirect URI (redirect_uri) will be. This URI determines the address to which authentication request responses will be directed.

Example:

https://your-domain.com.br/callback

Step 4: Get Access Token

For SSO Authentication

The basic authentication flow consists of:

  1. Redirect user to the authorization endpoint
  2. Receive the authorization code in the callback
  3. Exchange the code for tokens through the token endpoint
  4. Validate and use tokens as needed

Quick Example:

javascript
const authUrl = `{login-producao}/authorize?response_type=code&scope=openid profile&client_id=your_client_id&redirect_uri=https://your-domain.com.br/callback`;

window.location.href = authUrl;

For Connect Integrations

Get token using client_credentials:

javascript
const response = await fetch('{security-producao}/api/token?grant_type=client_credentials&client_id=your_client_id&client_secret=your_client_secret', {
  method: 'POST'
});

const { access_token } = await response.json();

Next Steps

SSO Authentication:

Integrations:

References:

Fanbase API Documentation