clerk_auth 0.0.12-beta copy "clerk_auth: ^0.0.12-beta" to clipboard
clerk_auth: ^0.0.12-beta copied to clipboard

Package that will allow you to authenticate and use Clerk from Dart code.

example/main.dart

// ignore_for_file: avoid_print

import 'dart:io';

import 'package:clerk_auth/clerk_auth.dart';

Future<void> main() async {
  final auth = Auth(
    config: AuthConfig(
      publishableKey: '<YOUR-PUBLISHABLE-KEY>',
      persistor: DefaultPersistor(
        getCacheDirectory: () => Directory.current,
      ),
      // To enable running of the example in e.g. Flutter environments where
      // [Directory.current] causes problems, use the `clerk_flutter` package and
      // use:
      // persistor: DefaultCachingPersistor(
      //   getCacheDirectory: getApplicationDocumentsDirectory,
      // )
      // Which will use the correct directory for the platform your Flutter app
      // is running on. You can also implement a bespoke [Persistor] specific
      // to your applications storage mechanism,
      //
      // or replace the above line with...
      // persistor: Persistor.none,
    ),
  );

  await auth.initialize();

  await auth.attemptSignIn(
    strategy: Strategy.password,
    identifier: '<USER-EMAIL>',
    password: '<PASSWORD>',
  );

  print('Signed in as ${auth.user}');

  await auth.signOut();

  auth.terminate();
}
6
likes
140
points
2.88k
downloads

Publisher

verified publisherclerk.com

Weekly Downloads

Package that will allow you to authenticate and use Clerk from Dart code.

Homepage
Repository (GitHub)
View/report issues

Topics

#authentication

Documentation

API reference

License

MIT (license)

Dependencies

collection, http, json_annotation, logging, meta

More

Packages that depend on clerk_auth