clerk_auth 0.0.12-beta
clerk_auth: ^0.0.12-beta copied to clipboard
Package that will allow you to authenticate and use Clerk from Dart code.
Official Clerk Dart SDK (Beta) #
⚠️ The Clerk Flutter SDK is in Beta ⚠️ #
❗️ Breaking changes should be expected until the first stable release (1.0.0) ❗️
Clerk helps developers build user management. We provide streamlined user experiences for your users to sign up, sign in, and manage their profile from your Dart code.
Requirements #
- Dart >= 3.6.2
Example Usage #
To use this package you will need to go to your Clerk Dashboard create an application and copy the public and publishable API keys into your project.
import 'dart:io';
import 'package:clerk_auth/clerk_auth.dart';
Future<void> main() async {
final auth = Auth(
config: const 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();
}
For more details see Clerk Auth object
License #
This SDK is licensed under the MIT license found in the LICENSE file.