auth_web_sdk 0.0.5 auth_web_sdk: ^0.0.5 copied to clipboard
Skillmine Auth Flutter Webview SDK
The auth_web_sdk package enables seamless integration of authentication in Flutter applications. It facilitates handling OAuth2 flows, allowing developers to easily manage user authentication and token retrieval within their apps.
Prerequisites #
- An existing Flutter project.
- Internet permission in your AndroidManifest.xml file.
- Support SDK
- Android 21+
- iOS 12.0+
How do I use auth-web package #
- First define empty access token
late final accessToken;
- By adding following code in on tap or directly to your scaffold body
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AuthWebViewSdkClass(
baseUrl:
"https://nightly-accounts-api.complyment.com/",
clientId: "d1d90d96-de43-4ee8-9c0b-d3f17d50ec6b",
responseType: "token",
scope: "openid%20profile%20user_info_all&",
redirectUrl:
"https://nightly-accounts.complyment.com/profile/personal-detail",
onTokenReceived: (String token) {
accessToken = token;
debugPrint('Received token: $token');
if (accessToken != null) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => SuccessScreen()));
}
},
)));
Make sure you have proper Base Url, client ID, Response Type, Scope and Redirect Url #
Additional information #
You should however make sure to set the correct minSdkVersion in android/app/build.gradle if it was previously lower than 19:
android {
defaultConfig {
minSdkVersion 21
}
}
Add the import of the implementation packages to your app or package
import 'package:auth_webview_sdk/auth_webview_sdk.dart';
Conclusion #
This guide has covered the basic steps to integrate and use the auth_webview_sdk Package in your Flutter app. For more advanced configurations and troubleshooting, contact Skillmine Technologies.