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

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

example/main.dart

import 'dart:io';

import 'package:clerk_auth/clerk_auth.dart';

Future<void> main() async {
  final api = Api(
    publishableKey: '<YOUR-PUBLISHABLE-KEY>',
    persistor: await DefaultPersistor.create(
      storageDirectory: Directory.current,
    ),
    httpService: const DefaultHttpService(),
  );

  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);
}
copied to clipboard
5
likes
0
points
971
downloads

Publisher

verified publisherclerk.com

Weekly Downloads

2024.09.30 - 2025.04.14

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

Homepage
Repository (GitHub)
View/report issues

Topics

#authentication

License

unknown (license)

Dependencies

collection, http, json_annotation, logging

More

Packages that depend on clerk_auth