# guruprakash-c/3rdpartylogin architecture

> Architecture diagram of the GitHub repository guruprakash-c/3rdpartylogin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/guruprakash-c/3rdpartylogin
- Repository: https://github.com/guruprakash-c/3rdpartylogin

## Overview

##### Main Components

a. Client Layer:
- Web Browser/Frontend
- Profile Pictures Storage
- WhatsApp Integration Component

b. Application Layer:
- Main PHP Application
- Authentication Controllers (one for each provider)
- Configuration Management
- User Data Objects

c. External Services:
- GitHub OAuth
- Google OAuth
- Microsoft AAD
- LinkedIn OAuth
- WhatsApp API

**[External Services Tier]**
- ↕
**[Application Tier]**
- ↕
**[Client Tier]**

##### Specific Component Representations

- Rectangles: Core application components
- Clouds: External OAuth providers
- Hexagons: API endpoints
- Rounded rectangles: Configuration files

- Blue: Core application components
- Green: External OAuth providers
- Orange: Configuration components
- Purple: Storage components
- Red: Security boundaries

##### Flow Representations

- Authentication flow paths for each provider
- Data flow between components
- User session management
- Profile picture handling
- WhatsApp message flow

##### Detailed Component Breakdown

Core Application (index.php):
**[Configuration Layer]**
- github.config.php
- google.config.php
- linkedin.config.php
- microsoft.config.php

**[Authentication Controllers]**
- index.github.php
- index.google.php
- index.linkedin.php
- index.microsoft.php
- index.ws.php

**[User Management]**
- UserDO.php
- logout.php
- logout.github.php

##### Important Elements to Highlight

a. Security Boundaries:
- OAuth token flow
- Secure storage areas

b. Integration Points:
- OAuth endpoints for each provider
- WhatsApp messaging integration
- Profile picture storage

##### Specific Flows to Document

a. Authentication Flow:
**User → Frontend → OAuth Provider → Callback → Application → Session Creation**

b. Profile Management:
**User → Frontend → Profile Picture Storage → User Data Object**

c. WhatsApp Integration:
**Application → WhatsApp API → Message Delivery**

##### Technical Details

- PHP Version requirements
- OAuth 2.0 protocol indicators
- Session management method
- Storage requirements
- API version compatibility

Remember to:
- Use consistent styling
- Version information
- Document all integration points
- Error handling paths
- Data persistence methods

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef external fill:#90EE90,stroke:#333
    classDef core fill:#ADD8E6,stroke:#333
    classDef config fill:#FFA500,stroke:#333
    classDef storage fill:#DDA0DD,stroke:#333
    classDef frontend fill:#FFE4B5,stroke:#333
    classDef security fill:#FF6B6B,stroke:#333

    %% Client Layer
    subgraph ClientLayer
        Browser["Web Browser"]:::frontend
        WhatsAppClient["WhatsApp JS Client"]:::frontend
        ProfileStorage["Profile Pictures Storage"]:::storage
    end

    %% Application Layer
    subgraph AppLayer
        MainApp["Main Application"]:::core
        
        subgraph AuthControllers["Authentication Controllers"]
            GitHubAuth["GitHub Auth"]:::core
            GoogleAuth["Google Auth"]:::core
            LinkedInAuth["LinkedIn Auth"]:::core
            MicrosoftAuth["Microsoft Auth"]:::core
            WhatsAppAuth["WhatsApp Auth"]:::core
        end
        
        subgraph ConfigManagement["Configuration Management"]
            GitHubConfig["GitHub Config"]:::config
            GoogleConfig["Google Config"]:::config
            LinkedInConfig["LinkedIn Config"]:::config
            MicrosoftConfig["Microsoft Config"]:::config
        end
        
        subgraph UserManagement["User Management"]
            UserDO["User Data Object"]:::core
            Logout["Logout Handler"]:::core
            GitHubLogout["GitHub Logout"]:::core
        end
        
        WhatsAppHandler["WhatsApp Message Handler"]:::core
        PrivacyHandler["Privacy Handler"]:::core
    end

    %% External Services Layer
    subgraph ExternalServices
        GitHub["GitHub OAuth"]:::external
        Google["Google OAuth"]:::external
        Microsoft["Microsoft AAD"]:::external
        LinkedIn["LinkedIn OAuth"]:::external
        WhatsAppAPI["WhatsApp API"]:::external
    end

    %% Relationships
    Browser --> MainApp
    Browser --> WhatsAppClient
    WhatsAppClient --> WhatsAppHandler
    WhatsAppHandler --> WhatsAppAPI
    
    MainApp --> AuthControllers
    MainApp --> ConfigManagement
    MainApp --> UserManagement
    MainApp --> ProfileStorage
    
    GitHubAuth --> GitHub
    GoogleAuth --> Google
    LinkedInAuth --> LinkedIn
    MicrosoftAuth --> Microsoft
    WhatsAppAuth --> WhatsAppAPI
    
    UserDO --> ProfileStorage

    %% Click Events
    click GitHubAuth "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/index.github.php"
    click GoogleAuth "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/index.google.php"
    click LinkedInAuth "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/index.linkedin.php"
    click MicrosoftAuth "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/index.microsoft.php"
    click WhatsAppAuth "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/index.ws.php"
    
    click GitHubConfig "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/github.config.php"
    click GoogleConfig "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/google.config.php"
    click LinkedInConfig "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/linkedin.config.php"
    click MicrosoftConfig "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/microsoft.config.php"
    
    click UserDO "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/UserDO.php"
    click Logout "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/logout.php"
    click GitHubLogout "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/logout.github.php"
    
    click WhatsAppClient "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/send_whatsapp_message.js"
    click WhatsAppHandler "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/ws_send_message.php"
    
    click ProfileStorage "https://github.com/guruprakash-c/3rdPartyLogin/tree/main/profile_pictures/"
    click MainApp "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/index.php"
    click PrivacyHandler "https://github.com/guruprakash-c/3rdPartyLogin/blob/main/privacy.php"

    %% Legend
    subgraph Legend
        L1["Frontend Component"]:::frontend
        L2["Core Component"]:::core
        L3["External Service"]:::external
        L4["Configuration"]:::config
        L5["Storage"]:::storage
    end
```
