okta_oidc_plus 1.0.0 copy "okta_oidc_plus: ^1.0.0" to clipboard
okta_oidc_plus: ^1.0.0 copied to clipboard

A modern Flutter plugin for Okta OIDC authentication enabling secure user login, token management, and identity integration using OpenID Connect with Okta services.

okta_oidc_plus #

pub package

A modern, high-performance Flutter plugin for Okta OIDC authentication. Seamlessly integrate secure user login, token management, PKCE flows, and identity integration with Okta in your Flutter applications.

Features #

  • 🔐 Secure OIDC Authentication: Built-in support for Okta WebAuth PKCE flow.
  • 🌐 Social Sign-In: Support for LinkedIn, Google, Apple, and custom IDP identity providers.
  • 🔑 Automatic Token Refresh: Transparently fetches and renews access tokens.
  • 👤 User Claims & Profile: Direct access to authenticated user claims payload.
  • 🏗️ Clean Architecture Example: Bundled with a production-ready Clean Architecture sample app.

Installation #

Add okta_oidc_plus to your pubspec.yaml:

dependencies:
  okta_oidc_plus: ^1.0.0

Platform Setup #

Android

  1. Ensure your minSdkVersion is set to 21 or higher in android/app/build.gradle:
android {
    compileSdkVersion 34

    defaultConfig {
        minSdkVersion 21
        manifestPlaceholders = [
            "appAuthRedirectScheme": "com.yourdomain.app"
        ]
    }
}
  1. Register your redirect URI scheme in your Android manifest or build placeholders as shown above.

iOS

  1. Set the minimum deployment target in ios/Podfile to 13.0 or higher:
platform :ios, '13.0'

Configuration #

Create an assets/okta_config.json file in your root project directory:

{
  "client_id": "YOUR_OKTA_CLIENT_ID",
  "redirect_uri": "com.yourdomain.app:/callback",
  "end_session_redirect_uri": "com.yourdomain.app:/logout",
  "scopes": ["openid", "profile", "email", "offline_access"],
  "discovery_uri": "https://YOUR_OKTA_DOMAIN.okta.com/oauth2/default"
}

Remember to declare the asset in pubspec.yaml:

flutter:
  assets:
    - assets/okta_config.json

Usage #

1. Initialize Okta Client #

import 'package:okta_oidc_plus/okta_oidc_plus.dart';

final oktaOidcPlus = OktaOidcPlus();

Future<void> initOkta() async {
  final configString = await rootBundle.loadString('assets/okta_config.json');
  final Map<String, dynamic> oktaConfig = jsonDecode(configString);
  await oktaOidcPlus.initOkta(oktaConfig);
}

2. User Sign-In #

final response = await oktaOidcPlus.login();
if (response != null && response['status'] == true) {
  print('Successfully logged in');
}

3. Social Sign-In #

final response = await oktaOidcPlus.socialLogin({
  "idp": "YOUR_IDP_ID",
  "idp-scope": "email profile",
});

4. Fetch Access Token #

final tokenResponse = await oktaOidcPlus.getAccessToken();
final accessToken = tokenResponse?['message'];

5. Fetch User Profile #

final userProfile = await oktaOidcPlus.getUserProfile();
print(userProfile);

6. Sign Out #

final isLoggedOut = await oktaOidcPlus.logout();

Sample App & Clean Architecture #

Check out the included example application featuring a production-ready Clean Architecture layout:

  • Domain Layer: Entities (UserEntity, AuthStatus), Repositories, and UseCases (LoginUseCase, LogoutUseCase, GetUserProfileUseCase, GetAccessTokenUseCase).
  • Data Layer: DataSources (OktaRemoteDataSource), Models (UserModel), and Repository Implementations.
  • Presentation Layer: State Notification (AuthNotifier), Custom Theme, Glassmorphism UI Components, and Dashboard views.

Author & Contact #

Developed and maintained by Eebrahim Joy.


License #

This project is licensed under the MIT License - see the LICENSE file for details.

1
likes
0
points
137
downloads

Publisher

verified publishereebrahimjoy.com

Weekly Downloads

A modern Flutter plugin for Okta OIDC authentication enabling secure user login, token management, and identity integration using OpenID Connect with Okta services.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on okta_oidc_plus

Packages that implement okta_oidc_plus