Last updated:
0 purchases
okta oidc
okta_oidc #
okta_oidc provide simple authentication integration in mobile apps.
Sample #
Check out sample app Okta oidc
Installation #
To add okta_oidc to your flutter application install instructions. Below are some Android and iOS specifics that are required for the okta_oidc to work correctly.
Android
Make sure you set the minSdkVersion 21 or above in your "android/app/build.gradle"
android {
minSdkVersion 21
...
}
copied to clipboard
Similar to the sample app, you must add a redirect scheme to receive sign in results from the web browser. To do this, you must define a gradle manifest placeholder in your app's build.gradle:
manifestPlaceholders = [
appAuthRedirectScheme: 'Add redirect schema here...'
]
copied to clipboard
iOS
Make sure the minimum deployment target in Podfile set to 13 or above
platform :ios, '13.0'
copied to clipboard
Add `assets/okta_config.json` file in root of your project with below data.
{
"client_id": "",
"redirect_uri": "",
"end_session_redirect_uri": "",
"scopes": [],
"discovery_uri": ""
}
copied to clipboard
Example #
Available Methods #
initOkta #
This method will initialize okta with config file or map data.
code
OktaOidc oktaOidc = OktaOidc();
...
...
Future<void> initOkta() async {
final String response =
await rootBundle.loadString('assets/okta_config.json');
Map<String, dynamic>? oktaConfig = jsonDecode(response);
oktaOidc.initOkta(oktaConfig);
}
copied to clipboard
login #
This method will redirect you to okta sign in page and return response or error.
code
oktaOidc.login().then((value) {
}).catchError((onError) {
});
copied to clipboard
socialLogin #
This method can be used for social login like linked in, google and apple sign in. Need to provide idp and idp-scope for social sign in.
code
oktaOidc.socialLogin({
"idp": "Add idp here...",
"idp-scope": "Add scope here..."
}).then((value) {
});
copied to clipboard
getAccessToken #
This method will return access token if logged in if token is expired it will refresh the token.
code
oktaOidc.getAccessToken();
copied to clipboard
getUserProfile #
This method returns user profile data.
code
oktaOidc.getUserProfile();
copied to clipboard
logout #
This method clears the user session.
code
oktaOidc.logout();
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.