Skip to content

Repository files navigation

AuthDemo

A demonstration of OAuth 2.0 Authorization Code Flow implementation with a Node.js backend and Android client application.

Features

  • Complete OAuth 2.0 Authorization Code Flow implementation
  • Node.js backend with Express.js
  • Android app using Jetpack Compose
  • Account Manager integration for token storage
  • Chrome Custom Tabs for secure authentication
  • JWT-based token authentication
  • Clean and modern Material 3 UI

Backend Features

  • OAuth 2.0 endpoints (/oauth/authorize, /oauth/token)
  • Protected resource endpoint (/api/user)
  • CORS support
  • JWT token generation and validation
  • Mock user database for testing
  • Authorization code management with expiration

Android App Features

  • Jetpack Compose UI
  • Android Account Manager integration
  • Chrome Custom Tabs for OAuth flow
  • Retrofit for API communication
  • Profile management
  • Auto login/logout handling

Test Accounts

Setup

Backend Setup

  1. Navigate to the server directory:
    cd server
  2. Install dependencies:
    npm install
  3. Create a .env file with:
    PORT=3000
    SECRET_KEY=your-oauth-demo-secret-key
    
  4. Start the server:
    npm start

Android Setup

  1. Open the project in Android Studio
  2. Sync Gradle files
  3. Run the app on an emulator or device

Architecture

  • Backend: Node.js + Express.js
  • Frontend: Android + Jetpack Compose
  • Authentication: OAuth 2.0 Authorization Code Flow
  • Token Storage: Android Account Manager
  • API Communication: Retrofit + OkHttp

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages