Fetching latest headlines…
An open-source Google Business Profile SDK with automatic OAuth refresh, pagination and retries.
NORTH AMERICA
🇺🇸 United StatesJune 28, 2026

An open-source Google Business Profile SDK with automatic OAuth refresh, pagination and retries.

0 views0 likes0 comments
Originally published byDev.to

Over the last few months I was working on a project that manages hundreds of Google Business Profile locations.

I expected the integration to be straightforward, but the API turned out to be much harder than I anticipated.

The biggest pain points were:
• OAuth access tokens expiring every hour
• Refresh token race conditions
• Manual pagination using nextPageToken
• Handling 429 rate limits and random 503 responses
• Writing the same boilerplate for every project

After solving these problems multiple times, I decided to extract everything into an open-source SDK.

Some features:
✅ Automatic OAuth token refresh
✅ Thread-safe token management
✅ Auto-pagination (fetch all pages automatically)
✅ Built-in retry with exponential backoff
✅ Fully typed TypeScript API
✅ Zero runtime dependencies

Example:
import { GBPClient, ConsoleLogger } from '@vitabletech/gbp-sdk';

const client = new GBPClient({
  clientId: 'YOUR_GOOGLE_CLIENT_ID',
  clientSecret: 'YOUR_GOOGLE_CLIENT_SECRET',
  refreshToken: 'YOUR_REFRESH_TOKEN',
  tokenStorage: 'file', 
// stores tokens in gbp-tokens.json
  logger: new ConsoleLogger(), 
// optional pluggable logger
});

async function main() {

// Automatically handles token generation and pagination!
  const accounts = await client.accounts.listAll();

  if (accounts.length > 0) {
    const accountName = accounts[0].name;
    const locations = await client.locations.listAll(accountName);

    console.log(`Found ${locations.length} locations for ${accountName}`);
  }
}

main();

The project is completely open source.

I'd really appreciate feedback from anyone who has worked with the Google Business Profile API.

What features would you want to see next?

GitHub: https://github.com/vitabletech/gbp-sdk
npm: https://www.npmjs.com/package/@vitabletech/gbp-sdk

Comments (0)

Sign in to join the discussion

Be the first to comment!