API Reference - Flutter
Create an SDK Instance
// import sdk
import 'package:flutterpluginfidologinapi/flutterpluginfidologinapi.dart';
// ...
// ...
// example app
class _MyAppState extends State<MyApp> {
void initState() {
super.initState();
initializeState();
}
// Fido login api plugin are asynchronous, so we initialize in an async method.
Future<void> initializeState() async {
String clientId = "032690b3-9bc4-4602-87c1-60c1fae782f2";
String baseURL = "https://060ce487-b934-43d0-a925-b66e80c7532f.{{brand_native_api}}";
await FPLoginApi.configure(clientId,baseURL);
// ...
// ...
}
// ...
// ...
}
registerWithFido2
Sign up a user for FIDO authentication.
static Future<RegisterResponse> registerWithFido2(String username, RegistrationOptions options) async
Where:
class RegistrationOptions {
String authToken;
}
Parameter | Type | Required | Details |
---|---|---|---|
username | string | true | Username of the customer to be registered. |
options | RegistrationOptions | optional | API Service token (JWT) signed by your Private Key, as per the API Credential added to the integration. |
registerWithPassword
Creates a user account with a password (not recommended). If leveraging this method, users should be migrating to use a FIDO authenticator, then have their password revoked.
static Future<RegisterResponse> registerWithPassword(String username, String password, String confirmationPassword, RegistrationOptions options) async
Where:
class RegistrationOptions {
String authToken;
}
Parameter | Type | Required | Details |
---|---|---|---|
username | string | true | Username of the customer to be registered. |
password | string | true | Password of the customer to be registered. |
passwordConfirmation | string | true | It is best practice to have the customer enter their password twice before creating their profile to prevent typos. If desired, you could only require the end user to enter their password once and pass that password in both fields. |
options | RegistrationOptions | optional | API Service token (JWT) signed by your Private Key, as per the API Credential added to the integration. |
authenticateWithFido2
Authenticate a previously registered user through FIDO2.
static Future<AuthenticateResponse> authenticateWithFido2(String username, AuthenticationOptions options) async
Where:
class AuthenticationOptions {
String authToken;
}
Parameter | Type | Required | Details |
---|---|---|---|
username | string | true | Username of the customer to be registered. |
options | AuthenticationOptions | optional | API Service token (JWT) signed by your Private Key, as per the API Credential added to the integration. |
authenticateWithPassword
Authenticate a previously registered user using username and password.
static Future<AuthenticateResponse> authenticateWithPassword(String username, String password, AuthenticationOptions options) async
Where:
class AuthenticationOptions {
String authToken;
}
Parameter | Type | Required | Details |
---|---|---|---|
username | string | true | Username of the customer to be authenticated. |
password | string | true | Password of the customer to be authenticated. |
options | AuthenticationOptions | optional | API Service token (JWT) signed by your Private Key, as per the API Credential added to the integration. |
confirmTransaction
Confirm the transaction of a text-based payload using registered Fido2 account.
static Future<TransactionResponse> transactionConfirmation(String username, TransactionPayload payload, TransactionOptions options) async
Where:
class TransactionPayload {
String nonce;
String data;
}
class TransactionOptions {
String authToken;
}
Parameter | Type | Required | Details |
---|---|---|---|
username | string | true | Username of the customer to be authenticated. |
payload | TransactionPayload | true | Require a client side generated nonce value and a text message to display back to user for confirmation. |
options | AuthenticationOptions | optional | API Service token (JWT) signed by your Private Key, as per the API Credential added to the integration. |
isLoggedIn
Check if a given user is currently logged in.