Daniel López Azaña

Theme

Social Media

OAuth Integration for Tour Tracking Platform - Secure White-Label Partnership System

OAuth 1.0 authentication and authorization system for German tour tracking social network, enabling secure white-label integration with partner websites. Custom PHP OAuth library implementation allowing third-party sites to consume tour data, user authentication, and social features while maintaining data isolation per partner. phpFox integration proof-of-concept demonstrating cross-platform compatibility. 3-month development delivering complete OAuth provider and consumer solution.

When a tour tracking social network wants to expand its reach through white-label partnerships, secure authentication and data sharing become critical challenges. This project involved implementing a complete OAuth 1.0 authentication and authorization system for a German client operating a social network with mobile applications (iPhone and Android) for tracking walking, driving, and biking routes, similar to Endomondo but focused on tourist routes rather than sports tracking.

OAuth Protocol Logo

I designed and implemented a custom OAuth provider on the client’s platform and a reference OAuth consumer implementation, enabling secure white-label integration with partner websites. The solution allowed third-party sites to offer the complete tour tracking functionality under their own branding while maintaining strict data isolation between partners and ensuring only authorized sites could access the platform’s services.

The Business Challenge: Secure White-Label Distribution

The client had successfully built a tour tracking platform with mobile applications and social features, but wanted to expand their market reach by allowing partner websites to offer the same functionality under their own brands.

Critical Business Requirements:

  • White-label distribution - Partner sites could offer tour tracking features branded as their own.
  • Secure authentication - Only authorized partner sites could connect to the platform.
  • User data isolation - Users registered on Partner A’s site could not see data from Partner B’s users.
  • Single sign-on experience - Users shouldn’t need separate logins for the partner site and tour platform.
  • Cross-platform compatibility - Partners could use any programming language/platform.
  • Data sharing control - Users must explicitly authorize partners to access their tour data.
  • Scalability - Support multiple partner integrations without code duplication.

The White-Label Model:

Partner websites would integrate the tour tracking functionality:

  • Users register on the partner site (which creates accounts on both systems).
  • Users track routes using the mobile app (branded for the partner).
  • Tours, photos, comments, and social interactions happen within the partner’s ecosystem.
  • Data remains isolated per partner (Partner A users can’t see Partner B content).
  • All functionality appears under the partner’s brand and design.

Security Challenges:

Traditional authentication methods (username/password sharing, API keys) were inadequate:

  • Password sharing - Users would need credentials for both sites (poor UX, security risk).
  • API keys alone - Insufficient security, no user-level authorization.
  • Custom solutions - Would require unique integration code per partner.

The Solution: OAuth Protocol

OAuth 1.0 provided the ideal solution, offering industry-standard security used by Google, Facebook, and Yahoo for third-party integrations. OAuth enabled:

  • Secure site-to-site authentication without password sharing.
  • User-level authorization (users control what data partners can access).
  • Standard protocol with libraries available in all major languages.
  • Proven security model used by major tech companies.

OAuth Architecture and Implementation

The solution required implementing both sides of OAuth: the provider (client’s tour platform) and a reference consumer (partner site integration).

OAuth Roles:

OAuth Provider (Tour Platform):

  • Stores protected resources (tours, photos, user data).
  • Authenticates consumer applications (partner sites).
  • Obtains user authorization for data access.
  • Issues access tokens for authenticated requests.
  • Validates incoming requests from consumers.

OAuth Consumer (Partner Sites):

  • Requests access to protected resources.
  • Obtains user authorization through OAuth flow.
  • Makes authenticated API calls with access tokens.
  • Displays tour data within their own interface.

Technology Stack

ComponentTechnologyPurpose
OAuth VersionOAuth 1.0Security protocol for authorization
Server LanguagePHP 5.3+OAuth provider implementation
DatabaseMySQL 5.5OAuth tokens and consumer registration
API ArchitectureRESTfulResource access endpoints
Reference ConsumerphpFoxProof-of-concept integration
Mobile AppsiOS/AndroidTour tracking applications
SecurityHMAC-SHA1 signaturesRequest authentication

OAuth Communication Flow

OAuth Flow Implementation

The OAuth 1.0 three-legged authentication flow was implemented to secure user authorization:

Step 1: Consumer Registration

Before any OAuth flows, partner sites must register with the provider:

  1. Partner applies for OAuth consumer account.
  2. Provider issues Consumer Key and Consumer Secret.
  3. Provider configures callback URLs for the partner.
  4. Consumer credentials stored securely by partner.

Step 2: Request Token

When a user wants to connect their account:

  1. User clicks “Connect Tours” on partner site.
  2. Consumer (partner) requests temporary request token from provider.
  3. Provider validates consumer credentials.
  4. Provider generates and returns request token.
  5. Consumer stores token temporarily.

Step 3: User Authorization

The user must explicitly authorize access:

  1. Consumer redirects user to provider’s authorization page.
  2. User logs into tour platform (if not already logged in).
  3. Provider displays authorization request: “Partner Site wants to access your tours. Allow?”
  4. User reviews requested permissions and approves/denies.
  5. If approved, provider redirects user back to consumer with authorized request token.

Step 4: Access Token Exchange

Consumer exchanges authorized request token for permanent access token:

  1. Consumer sends request token to provider’s access token endpoint.
  2. Provider validates request token and user authorization.
  3. Provider generates access token and token secret.
  4. Provider returns access token to consumer.
  5. Consumer stores access token securely.

Step 5: Authenticated API Requests

Consumer makes API calls on behalf of the user:

  1. Consumer creates API request (e.g., GET /api/tours).
  2. Consumer signs request using access token and consumer secret.
  3. Provider validates request signature and access token.
  4. Provider returns requested data if valid.
  5. Consumer displays data in their interface.

Security Through Signatures:

Every OAuth request was signed using HMAC-SHA1:

  • Signature generated from request parameters, timestamp, nonce, and secrets.
  • Provider validates signature on every request.
  • Prevents replay attacks (timestamp and nonce checking).
  • Protects against man-in-the-middle attacks.

Custom OAuth Library Development

I developed a customized PHP OAuth library optimized for the tour platform’s specific requirements:

Provider Library Features:

Consumer Management:

  • Register new consumer applications (partner sites).
  • Store consumer keys and secrets securely.
  • Configure callback URLs per consumer.
  • Revoke consumer access when needed.
  • Usage statistics and rate limiting per consumer.

Token Management:

  • Generate cryptographically secure request tokens.
  • Track token authorization status.
  • Exchange authorized request tokens for access tokens.
  • Token expiration and renewal mechanisms.
  • Token revocation by user or administrator.

Request Validation:

  • Signature verification for all incoming requests.
  • Timestamp validation (reject old requests).
  • Nonce tracking to prevent replay attacks.
  • Consumer authentication on every request.
  • Access token validation and permission checking.

Resource Access Control:

  • User-level data isolation (Partner A users vs. Partner B users).
  • Scope-based permissions (read tours, write comments, etc.).
  • API endpoint access control per consumer.
  • Rate limiting per consumer to prevent abuse.

Consumer Library Features:

Built reference consumer implementation for partner integration:

OAuth Flow Management:

  • Request token acquisition.
  • User authorization redirect handling.
  • Access token exchange.
  • Token storage and retrieval.
  • Automatic token refresh when needed.

Authenticated API Calls:

  • Request signing using consumer and token secrets.
  • HTTP client with OAuth authentication built-in.
  • Automatic retry on transient failures.
  • Error handling for OAuth-specific responses.

Data Presentation:

  • Fetch user’s tours from provider API.
  • Display tour details (route, distance, duration, photos).
  • Show tour photos in partner’s gallery interface.
  • Render comments and social interactions.
  • Maintain partner’s branding throughout.

phpFox Integration: Proof of Concept

To validate the OAuth implementation, I integrated it with phpFox, a popular social network platform. This demonstrated cross-platform compatibility (different social network software could integrate successfully).

Integration Components:

phpFox OAuth Module:

  • Custom phpFox module implementing OAuth consumer.
  • “Connect Tours” button in user profile.
  • OAuth flow handlers integrated with phpFox authentication.
  • Tour browsing interface within phpFox design language.

Tour Display:

  • User’s tours listed in their phpFox profile.
  • Tour detail pages showing route maps.
  • Photo galleries from tours integrated with phpFox media system.
  • Comments and likes using phpFox’s social features.

User Experience:

  1. phpFox user clicks “Connect Tours” in their profile.
  2. OAuth flow redirects to tour platform for authorization.
  3. User authorizes phpFox to access their tours.
  4. User redirected back to phpFox with connected account.
  5. Tours automatically synced and displayed in phpFox profile.
  6. Other phpFox users can view tours, photos, and interact.

Tour Books Integration in phpFox

Data Isolation and Multi-Tenancy

A critical requirement was ensuring users from different partner sites couldn’t see each other’s data, despite sharing the same underlying tour platform.

Implementation Strategy:

Partner-Specific User Registration:

  • Each OAuth consumer (partner) has unique consumer key.
  • User accounts tagged with originating consumer key.
  • User authentication checks consumer context.
  • Cross-partner account merging prevented.

Data Segregation:

  • Tours, photos, comments tagged with user’s consumer context.
  • API queries filtered by consumer context automatically.
  • Partner A’s users only see content from other Partner A users.
  • Platform administrator has view across all partners for support.

Social Features Isolation:

  • Friend relationships scoped to consumer context.
  • Activity feeds show only same-partner content.
  • Search results filtered by partner affiliation.
  • Comments and likes only visible within partner ecosystem.

Mobile App Integration:

  • Mobile apps white-labeled per partner.
  • Apps authenticate users with partner-specific credentials.
  • Tour uploads tagged with partner context.
  • Cross-partner content leakage prevented at app level.

Security Considerations

OAuth implementation required careful attention to security best practices:

Secret Management:

  • Consumer secrets never transmitted over network.
  • Access token secrets stored encrypted in database.
  • Secrets rotated periodically.
  • Compromised secrets could be revoked immediately.

Transport Security:

  • HTTPS required for all OAuth endpoints.
  • Certificate validation enforced.
  • Redirect URLs validated against registered callbacks.
  • No sensitive data in query strings.

Attack Prevention:

  • Replay attacks - Nonce and timestamp validation.
  • CSRF attacks - OAuth state parameter validation.
  • Token theft - Short-lived request tokens, one-time use.
  • Brute force - Rate limiting on token endpoints.
  • SQL injection - Prepared statements throughout.

Privacy Protection:

  • User authorization page clearly shows what data is shared.
  • Users can revoke access tokens at any time.
  • Audit log of all OAuth authorizations.
  • Partner access limited to explicitly granted scopes.

Technical Challenges and Solutions

Challenge 1: Signature Generation Inconsistencies

Different languages encode URL parameters differently, causing signature mismatches.

Solution: Implemented strict OAuth specification compliance for parameter encoding and sorting. Created comprehensive test suite with known-good signatures from multiple OAuth implementations. Documented encoding requirements clearly for partner integrations.

Challenge 2: Token Storage and Retrieval

Managing tokens across distributed requests with session handling.

Solution: Designed efficient token storage schema in database with indexed lookups. Implemented caching layer for frequently accessed tokens. Created token lifecycle management system handling creation, authorization, exchange, and expiration.

Challenge 3: Mobile App Integration

Mobile apps needed to interact with OAuth flow designed for web browsers.

Solution: Implemented OAuth flow adapted for mobile: in-app WebView for authorization, custom URL scheme for callbacks, secure token storage in mobile OS keychain. Provided mobile-optimized authorization pages.

Challenge 4: Debugging OAuth Issues

Troubleshooting OAuth failures requires understanding the complete flow across both systems.

Solution: Built comprehensive logging system tracking each OAuth step. Created admin panel showing OAuth request/response details. Developed validation tool for partners to test their OAuth implementation against the provider.

Project Outcome

The OAuth integration system successfully enabled the tour platform to expand through white-label partnerships while maintaining security and data isolation.

Business Results:

  • White-label capability achieved - Partners could offer tour tracking under their own brands.
  • Secure integration - Industry-standard OAuth security protecting user data.
  • Platform agnostic - Partners could integrate regardless of their technology stack.
  • User experience optimized - No password sharing, seamless authorization flow.
  • Scalability proven - phpFox integration validated approach for multiple partners.

Technical Achievements:

  • Custom PHP OAuth 1.0 provider implementation.
  • Reference consumer library for partner integrations.
  • Complete OAuth flow (request token, authorization, access token, API calls).
  • Data isolation ensuring multi-tenant privacy.
  • phpFox integration proof-of-concept.
  • Comprehensive security measures (signatures, nonces, timestamps).
  • Mobile app compatibility for white-labeled apps.

Key Learnings

1. OAuth Complexity Requires Good Documentation - Clear documentation with code examples in multiple languages was essential for partner integrations.

2. Security Cannot Be Compromised - Strict adherence to OAuth specification prevented security vulnerabilities. No shortcuts were acceptable.

3. Testing Across Platforms is Critical - The phpFox integration revealed edge cases that wouldn’t have been discovered testing against the platform alone.

4. User Experience Matters in Security Flows - The authorization page design significantly impacted user trust and authorization conversion rates.

5. Multi-Tenancy Complexity - Data isolation in shared infrastructure requires careful architectural design from the beginning.

Conclusion

This OAuth integration project demonstrated how industry-standard security protocols can enable sophisticated business models like white-label partnerships. By implementing OAuth 1.0 correctly, the tour tracking platform could securely share functionality with partners while maintaining complete data isolation and user privacy.

The solution balanced security requirements with user experience, technical correctness with practical integration needs, and platform openness with data protection. The phpFox integration validated the approach and provided a reference implementation for future partners.

This experience reinforced the importance of leveraging proven standards (OAuth) rather than inventing custom authentication schemes, and the value of building reusable libraries that enable ecosystem growth through partnerships.


Confidentiality Note: Client name and specific platform details have been omitted per confidentiality agreement. Screenshots show the integration interface with OAuth provider (green) and consumer (blue) components highlighted for clarity.

Daniel López Azaña

About the author

Daniel López Azaña

Tech entrepreneur and cloud architect with over 20 years of experience transforming infrastructures and automating processes.

Specialist in AI/LLM integration, Rust and Python development, and AWS & GCP architecture. Restless mind, idea generator, and passionate about technological innovation and AI.

Related projects

Bowob chat service integration

Bowob Chat Integration Plugins - Multi-Platform Chat System Connectors for CMS and Social Networks

Development of integration plugins for Bowob.com chat service enabling seamless embedded chat functionality across multiple content management systems and social networking platforms. Created custom connectors for phpFox, Social Engine, Joomla Community Builder, Kunena forum, and Simple Machines Forum (SMF), providing webmasters with one-click installation for complete chat solutions. Plugins integrated user authentication, profile synchronization, friend connections, and user interface customization, allowing site members to communicate in real-time while maintaining platform-native user experience and data consistency.

Bowob.com2011-2012
Animal shelter solidarity shop homepage

Animal Shelter Solidarity Shop - PrestaShop E-commerce for Non-Profit Fundraising

Complete PrestaShop-based solidarity e-commerce platform developed pro-bono for Huellas Animal Shelter, featuring product catalog management, shopping cart, customer accounts, order processing, payment integration, and comprehensive admin panel. Ready-to-deploy solution available free for other animal shelters and NGOs. 2-month pro-bono development.

Huellas Animal Shelter2013
Apartment rental marketing website homepage

Apartment Rental Marketing Website - Digital Strategy to Stand Out in Economic Crisis

Personal marketing website created to successfully rent an apartment during Spain's 2010 economic crisis. Built on Joomla CMS, this single-property showcase site featured professional photography galleries, detailed property information, neighborhood highlights, and integrated contact forms. The project demonstrated how effective digital marketing and professional web presence can differentiate a property listing in a highly competitive, crisis-affected rental market. Successfully achieved rental to excellent tenants within target timeframe despite challenging economic conditions affecting Spain's construction and real estate sectors.

Personal Project2010

Comments

Be the first to comment

Submit comment

Have a Similar Project in Mind?

Let's discuss how I can help you achieve your goals

Start a Conversation