Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Latest commit

 

History

History
59 lines (38 loc) · 1.77 KB

README.md

File metadata and controls

59 lines (38 loc) · 1.77 KB

magic_flutter

magic_flutter is a Flutter plugin for Magic SDK that you can integrate into your application to enable passwordless authentication using magic links - similar to Slack and Medium.

Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase. Flutter is used by developers and organizations around the world, and is free and open source.

Prerequisites

  • Flutter SDK

Usage

Intialize Magic SDK

Initializes a new Magic SDK instance using the given publisherKey,and returns a bool. On initializing successfully, it will return true.

final result = await Magic.initializeMagic(publisherKey: publisherKey)

Login with Magic link

Allows users to login with magic link. Upon successful login, returns Future<DidToken>.

final didToken = await Magic.initialize(email: "email address");

Get user meta data

Method to get meta data of already logged in user. Returns Future<GetMetaDataResponse> on success.

final getMetaDataResponse = await Magic.getMetaData();

Update email

Method to update email id of already logged in user. The method should be used if user is already logged in. Returns true if successfully udpated.

final isUpdated = await Magic.updateEmail(email: "emailAddress");

Get login status

Returns Future<bool>, which denotes if user has already logged in, or not.

final isLoggedIn = await Magic.isLoggedIn();

Logout

Method to logout, if user is logged in. Returns Future<bool> to denote, whether user has successfully logged out.

final isLoggedOut = await Magic.logout();