HamugaId class
The main class for Hamuga ID SDK.
This is a singleton class that manages authentication with Hamuga ID. Initialize it once using initialize, then access via instance.
Example:
void main() {
WidgetsFlutterBinding.ensureInitialized();
HamugaId.initialize(
const HamugaIdConfig(
clientId: 'YOUR_CLIENT_ID',
redirectUri: 'YOUR_REDIRECT_URI',
scopes: [HamugaIdScope.openid, HamugaIdScope.email],
),
);
runApp(const MyApp());
}
Properties
- config → HamugaIdConfig
-
Gets the global configuration.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onAuthResponse
→ Stream<
HamugaIdResponse> -
Stream of authentication responses.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Closes the in-app browser view.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
signIn(
{String? clientId, String? redirectUri, List< HamugaIdScope> ? scopes, String? state, String? baseUrl, String? responseType, HamugaIdUsername? username, bool? autoClose}) → Future<HamugaIdResponse> - Initiates the sign-in process.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
buildUrl(
{required String clientId, required String redirectUri, required List< HamugaIdScope> scope, String? baseUrl = "https://id.hamuga.mn/auth/login", String? state, String? responseType, HamugaIdUsername? username}) → Uri - Builds the authentication URL.
-
getAuthCodeFromUrl(
String url) → String? - Extracts the authentication code from a URL.
-
initialize(
HamugaIdConfig config) → void - Initializes the SDK with configuration.
-
listenDeepLink(
dynamic onResponse(HamugaIdResponse)) → void - Listens to deep link authentication responses.
-
open(
{required String clientId, required String redirectUri, required List< HamugaIdScope> scope, String? state, String? baseUrl, String? responseType, HamugaIdUsername? username}) → Future<void> - Opens the Hamuga ID authentication flow.