Hyphen
  • Hyphen
  • Concepts
    • Auth Methods
    • Hyphen Multi-Sig Account
      • Device Key
      • Recovery Key
      • Server Key
    • Paymaster
    • Hybrid Custody
  • Mechanism Paper
  • iOS SDK
    • Quick Start
    • Authenticating Users
    • Using Hyphen UI Kit
      • Account Management Screen
    • Sample Project
  • Android SDK
    • Quick Start
    • Authenticating Users
    • Handling 2FA / Transaction Request
    • Using Hyphen UI Kit
    • Sending Transactions
  • Flutter SDK
    • Quick Start
    • Authenticating Users
    • Using Hyphen UI Kit
    • Sending Transactions
    • Example App
  • Hybrid Custody
    • Into the Hybrid Custody
  • Without Using SDK
    • Authenticating Users
    • Handling 2FA Push
  • REST API
    • API Reference
      • Account
      • Auth
      • Device
      • Key
      • Sign
    • Swagger
Powered by GitBook
On this page
  • Integrate Hyphen Authenticate
  • Authenticate with Google Account

Was this helpful?

  1. Flutter SDK

Authenticating Users

PreviousQuick StartNextUsing Hyphen UI Kit

Last updated 1 year ago

Was this helpful?

In Flutter, Hyphen Authentication functionalities are provided by the authenticate module of the SDK. This module enables users to perform various authentication tasks such as signing in, creating an account, and retrieving the user's key and account information.

Integrate Hyphen Authenticate

The HyphenAuthenticate class provides functionalities for authentication using the Hyphen SDK.

  • getAccount: Retrieves the user's account information.

  • authenticate: Initiates the authentication process with the provided webClientId.

try {
  // Retrieve user's account information
  await HyphenAuthenticate.getAccount();

  // Authenticate user with webClientId
  await HyphenAuthenticate.authenticate("your_web_client_id");
} catch (e) {
  // Handle errors
  print("Error: $e");
}

Authenticate with Google Account

Currently, Hyphen SDK only supports authentication via Google Account.

You must use the Web Client ID on the Google Cloud Platform for Google Authentication. See also .

HyphenAuthenticate.authenticate(
    webClientId = "<YOUR-WEB-CLIENT-ID>" // ex. 201778913659-dn4bo82q6hce3kfp7vstp04b22nh5hbi.apps.googleusercontent.com
)

Once authenticated successfully, you can get your HyphenAccount and retrieve information such as the account address.

final HyphenAccount hyphenAccount = await HyphenAuthenticate.getAccount();
if (hyphenAccount != null) {
  // Access the first address
  final String firstAddress = hyphenAccount.addresses.first.address;
  print("Address: $firstAddress"); // Print the first address
} 
Get your Google API client ID