Custom Login Widget

A reusable Flutter widget for OAuth 2.0 authentication that can be plugged into different projects. This widget allows seamless integration with OAuth providers like Google, Microsoft, and others.


Features

  • Supports OAuth 2.0 flows (Authorization Code Grant).
  • Customizable configuration for client ID, redirect URI, and OAuth endpoints.
  • Handles OAuth token exchange and authorization flow.
  • Easy-to-use plug-and-play widget.

Installation

Add the following dependency in your pubspec.yaml:

dependencies:
  custom_login_widget: ^1.0.0
import 'package:custom_login_widget/custom_login_widget.dart';
CustomLoginWidget(
  clientId: 'YOUR_CLIENT_ID',
  redirectUri: 'YOUR_REDIRECT_URI',
  authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth',
  tokenEndpoint: 'https://oauth2.googleapis.com/token',
  scopes: ['openid', 'profile', 'email'],
  onLoginSuccess: (accessToken) {
    print('Access Token: $accessToken');
  },
  onLoginError: (error) {
    print('Login Error: $error');
  },
);