-
Notifications
You must be signed in to change notification settings - Fork 414
[Do not Merge] Flutter push authentication package documentation #6113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
7747342
ee3bb0f
ab67d8f
887cffa
fc0affd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Managing Accounts | ||
|
Check warning on line 3 in en/asgardeo/docs/sdks/flutter/push-authentication/apis/account-management.md
|
||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/apis/account-management.md" %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Handling Push Notifications | ||
|
Check warning on line 3 in en/asgardeo/docs/sdks/flutter/push-authentication/apis/handle-push-notifications.md
|
||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/apis/handle-push-notifications.md" %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Registering the Device | ||
|
Check warning on line 3 in en/asgardeo/docs/sdks/flutter/push-authentication/apis/register-device.md
|
||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/apis/register-device.md" %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Sending the Auth Response | ||
|
Check warning on line 3 in en/asgardeo/docs/sdks/flutter/push-authentication/apis/send-auth-response.md
|
||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/apis/send-auth-response.md" %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Unregistering the Device | ||
|
Check warning on line 3 in en/asgardeo/docs/sdks/flutter/push-authentication/apis/unregister-device.md
|
||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/apis/unregister-device.md" %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Updating the Device | ||
|
Check warning on line 3 in en/asgardeo/docs/sdks/flutter/push-authentication/apis/update-device.md
|
||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/apis/update-device.md" %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Configuring Notification Handlers | ||
|
Check warning on line 3 in en/asgardeo/docs/sdks/flutter/push-authentication/guides/configure-notification-handlers.md
|
||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/guides/configure-notification-handlers.md" %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Setting Up Push Providers | ||
|
Check warning on line 3 in en/asgardeo/docs/sdks/flutter/push-authentication/guides/set-up-push-providers.md
|
||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/guides/set-up-push-providers.md" %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Overview | ||
| --- | ||
| {% include "../../../../../includes/sdks/flutter/push-authentication/overview.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Builder Options | ||
|
Check warning on line 3 in en/asgardeo/docs/sdks/flutter/push-authentication/references/builder-options.md
|
||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/references/builder-options.md" %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Custom Managers | ||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/references/custom-managers.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Error Handling | ||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/references/error-handling.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Managing Accounts | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/apis/account-management.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Handling Push Notifications | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/apis/handle-push-notifications.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Registering the Device | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/apis/register-device.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Sending the Auth Response | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/apis/send-auth-response.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Unregistering the Device | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/apis/unregister-device.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Updating the Device | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/apis/update-device.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Configuring Notification Handlers | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/guides/configure-notification-handlers.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Setting Up Push Providers | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/guides/set-up-push-providers.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Overview | ||
| --- | ||
| {% include "../../../../../../includes/sdks/flutter/push-authentication/overview.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Builder Options | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/references/builder-options.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Custom Managers | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/references/custom-managers.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| template: templates/sdk.html | ||
| heading: Error Handling | ||
| --- | ||
| {% include "../../../../../../../includes/sdks/flutter/push-authentication/references/error-handling.md" %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| After registration, the SDK keeps a local record of every enrolled account. The account-management APIs let you list and look up these accounts and read each account's push authentication history. | ||
|
|
||
| All operations are accessed through the `AsgardeoPushAuth.instance` singleton. | ||
|
|
||
| ## getAccounts() | ||
|
|
||
| Returns all locally registered accounts. | ||
|
|
||
| ```dart | ||
| Future<List<PushAuthAccount>> getAccounts() | ||
| ``` | ||
|
|
||
| ```dart title="List all registered accounts" | ||
| final accounts = await AsgardeoPushAuth.instance.getAccounts(); | ||
| for (final account in accounts) { | ||
| print('${account.username} @ ${account.organizationName ?? account.tenantDomain}'); | ||
| } | ||
| ``` | ||
|
|
||
| ## getAccount() | ||
|
|
||
| Returns a single account by its local identifier, or `null` if not found. | ||
|
|
||
| ```dart | ||
| Future<PushAuthAccount?> getAccount(String accountId) | ||
| ``` | ||
|
|
||
| | Parameter | Type | Required | Description | | ||
| |-----------|------|----------|-------------| | ||
| | `accountId` | `String` | ✅ | Local identifier of the account to look up | | ||
|
|
||
| ```dart title="Look up an account by local ID" | ||
| final account = await AsgardeoPushAuth.instance.getAccount(accountId); | ||
| ``` | ||
|
|
||
| ## getAccountByDeviceId() | ||
|
|
||
| Returns a single account by the server-assigned device identifier, or `null` if not found. | ||
|
|
||
| ```dart | ||
| Future<PushAuthAccount?> getAccountByDeviceId(String deviceId) | ||
| ``` | ||
|
|
||
| | Parameter | Type | Required | Description | | ||
| |-----------|------|----------|-------------| | ||
| | `deviceId` | `String` | ✅ | Device identifier assigned by {{product_name}} during registration | | ||
|
|
||
| ```dart title="Look up an account by device ID" | ||
| final account = await AsgardeoPushAuth.instance.getAccountByDeviceId(deviceId); | ||
| ``` | ||
|
|
||
| ## getAuthHistory() | ||
|
|
||
| Returns the push authentication history for a given account. | ||
|
|
||
| ```dart | ||
| Future<List<PushAuthRecord>> getAuthHistory(String accountId) | ||
| ``` | ||
|
|
||
| | Parameter | Type | Required | Description | | ||
| |-----------|------|----------|-------------| | ||
| | `accountId` | `String` | ✅ | Local identifier of the account whose history to retrieve | | ||
|
|
||
| ```dart title="Read push authentication history" | ||
| final records = await AsgardeoPushAuth.instance.getAuthHistory(accountId); | ||
| for (final record in records) { | ||
| print('${record.applicationName} — ${record.status}'); | ||
| } | ||
| ``` | ||
|
|
||
| ## PushAuthAccount fields | ||
|
|
||
| | Field | Type | Description | | ||
| |-------|------|-------------| | ||
| | `id` | `String` | Local account identifier | | ||
| | `username` | `String` | Username associated with the account | | ||
| | `displayName` | `String` | Display name for the account | | ||
| | `deviceId` | `String` | Device identifier assigned by the server | | ||
| | `host` | `String` | {{product_name}} server host URL | | ||
| | `tenantDomain` | `String?` | Tenant domain of the root organization user | | ||
| | `organizationId` | `String?` | Sub-organization identifier, if applicable | | ||
| | `organizationName` | `String?` | Sub-organization name, if applicable | | ||
| | `userStoreDomain` | `String?` | User store domain | | ||
|
|
||
| ## PushAuthRecord fields | ||
|
|
||
| | Field | Type | Description | | ||
| |-------|------|-------------| | ||
| | `pushAuthId` | `String` | Unique identifier of the push authentication request | | ||
| | `applicationName` | `String` | Application that requested authentication | | ||
| | `status` | `String` | `APPROVED` or `DENIED` | | ||
| | `respondedTime` | `int` | Epoch-millisecond timestamp when the response was sent | | ||
| | `ipAddress` | `String` | IP address from which the login attempt originated | | ||
| | `deviceOS` | `String` | OS of the requesting device | | ||
| | `browser` | `String` | Browser or client that initiated the login | | ||
| | `accountId` | `String` | Local ID of the account that handled the request | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| When {{product_name}} sends a push authentication request, your app receives a raw notification payload through FCM or APNs. The SDK provides a single helper to convert that payload into a typed request your code can act on. | ||
|
|
||
| For details on wiring up FCM and APNs handlers in your app, see the [Configure Notification Handlers]({{base_path}}/sdks/flutter/push-authentication/guides/configure-notification-handlers/) guide. | ||
|
|
||
| ## parsePushNotification() | ||
|
|
||
| Converts a raw push notification payload into a typed `PushAuthRequest`. Returns `null` for notifications that did not originate from {{product_name}}, making it safe to call inside any shared notification handler. | ||
|
|
||
| ```dart | ||
| PushAuthRequest? parsePushNotification( | ||
| Map<String, dynamic> data, { | ||
| int? sentTime, | ||
| }) | ||
| ``` | ||
|
|
||
| | Parameter | Type | Required | Description | | ||
| |-----------|------|----------|-------------| | ||
| | `data` | `Map<String, dynamic>` | ✅ | Raw notification payload (`message.data` from FCM, or the APNs userInfo map) | | ||
| | `sentTime` | `int?` | ❌ | Epoch-millisecond timestamp when the notification was sent | | ||
|
|
||
| ```dart title="Parse a push notification" | ||
| final request = AsgardeoPushAuth.instance.parsePushNotification( | ||
| message.data, | ||
| sentTime: message.sentTime?.millisecondsSinceEpoch, | ||
| ); | ||
|
|
||
| if (request != null) { | ||
| // Present the auth request to the user. | ||
| } | ||
| ``` | ||
|
|
||
| ## PushAuthRequest fields | ||
|
|
||
| | Field | Type | Description | | ||
| |-------|------|-------------| | ||
| | `pushId` | `String` | Unique identifier for this push authentication request | | ||
| | `challenge` | `String` | Server-issued challenge string | | ||
| | `numberChallenge` | `String?` | Optional number for number-matching flows | | ||
| | `relativePath` | `String?` | Resolved relative path for the authentication endpoint | | ||
| | `deviceId` | `String` | Device identifier this notification targets | | ||
| | `username` | `String` | Username of the authenticating user | | ||
| | `tenantDomain` | `String` | Tenant domain of the user's organization | | ||
| | `organizationId` | `String?` | Sub-organization identifier, if applicable | | ||
| | `organizationName` | `String?` | Sub-organization name, if applicable | | ||
| | `userStoreDomain` | `String` | User store domain | | ||
| | `applicationName` | `String` | Name of the application requesting authentication | | ||
| | `notificationScenario` | `String` | Scenario type (e.g., `AUTHENTICATION`) | | ||
| | `ipAddress` | `String` | IP address from which the login attempt originated | | ||
| | `deviceOS` | `String` | OS of the requesting device | | ||
| | `browser` | `String` | Browser or client that initiated the login | | ||
| | `sentTime` | `int` | Epoch-millisecond timestamp when the notification was sent | |
Uh oh!
There was an error while loading. Please reload this page.