clerk_auth 0.0.3-dev copy "clerk_auth: ^0.0.3-dev" to clipboard
clerk_auth: ^0.0.3-dev copied to clipboard

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


Clerk Auth / Pre-release Alpha #

The official Clerk Dart client library.

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

Pub Version Pub Points chat on Discord documentation twitter

Requirements #

  • Dart >= 3.5.0

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 'package:clerk_auth/clerk_auth.dart';

Future<void> main() async {
  final api = Api(
    publicKey: '<YOUR-PUBLIC-KEY>',
    publishableKey: '<YOUR-PUBLISHABLE-KEY>',
  );

  final response = await api.createSignIn(identifier: '<USER-EMAIL>');
  assert(response.client?.signIn?.status == Status.needsFirstFactor);

  final signIn = response.client!.signIn!;
  final attemptResponse = await api.attemptSignIn(
    signIn,
    stage: Stage.first,
    strategy: Strategy.password,
    password: '<PASSWORD>',
  );

  final client = attemptResponse.client;
  assert(client?.signIn == null);
  assert(client?.activeSession?.status == Status.active);
  assert(client?.activeSession?.publicUserData.identifier.isNotEmpty == true);
}

License #

This SDK is licensed under the MIT license found in the LICENSE file.

2
likes
140
pub points
4%
popularity

Publisher

verified publisherclerk.com

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, dart_jsonwebtoken, http, json_annotation, logging

More

Packages that depend on clerk_auth