🔒Authentication

First time authentication to save token/tokenSecret

You can use your email/password combination initially to retrieve an OAuth1 token/secret combination which you can use on to reauthenticate when reloading the application. You can use any persistent storage system such as https://pub.dev/packages/localstorage.

import 'package:flutter_fibricheck_sdk/flutter_fibricheck_sdk.dart';

_storage = new LocalStorage('my_app');
_sdk = FLFibriCheckSdk.client("consumerKey", "consumerSecret");

var res = await _sdk.authenticateWithEmail(
      ParamsOauth1WithEmail(email: "email", password: "password"),
      (consents) {
        _onConsentNeeded(consents);
      },
    );
    
//save token
storage.setItem('token', res.token);
//save token secret
storage.setItem('tokenSecret', res.tokenSecret);

Afterwards you can use the stored tokenData to authenticate.


var res = await _sdk.authenticateWithToken(
      ParamsOauth1WithToken(token: storage.getItem('token'), tokenSecret: storage.getItem('tokenSecret')), (consents) {
        _onConsentNeeded(consents);
      },)

Last updated