AuthApi class

Authentication API for Magento integration.

This class provides comprehensive authentication functionality for Magento, including customer login, registration, password management, and social authentication.

Features

  • Customer Login: Authenticate with email and password
  • Customer Registration: Create new customer accounts
  • Password Management: Change passwords and reset forgotten passwords
  • Social Login: Support for social media authentication
  • Token Management: Automatic token storage and refresh
  • Session Management: Login/logout functionality

Usage

final authApi = AuthApi(apiClient);

// Login customer
final response = await authApi.login(
  email: 'customer@example.com',
  password: 'password123',
);

// Register new customer
final customer = await authApi.register(
  request: CustomerCreateRequest(...),
);

Constructors

AuthApi(MagentoApiClient _client)

Properties

currentCustomerId → int?
Get current customer ID
no setter
hashCode → int
The hash code for this object.
no setterinherited
isAuthenticated → bool
Check if user is authenticated
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

changePassword({required PasswordChangeRequest request}) → Future<bool>
Change customer password
getCurrentCustomer() → Future<Customer>
Get current customer information
login({required String email, required String password}) → Future<AuthResponse>
Authenticate customer with email and password.
logout() → Future<void>
Logout customer
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refreshToken({required String refreshToken}) → Future<AuthResponse>
Refresh access token
register({required CustomerCreateRequest request}) → Future<Customer>
Register a new customer account.
resetPassword({required String email}) → Future<bool>
Reset customer password
socialLogin({required String provider, required String token, String? email, String? firstname, String? lastname}) → Future<AuthResponse>
Social login
toString() → String
A string representation of this object.
inherited
updateCustomer({required CustomerUpdateRequest request}) → Future<Customer>
Update customer information

Operators

operator ==(Object other) → bool
The equality operator.
inherited