Skip to content

Commit 4f094c6

Browse files
authored
Feat (Auth): added docs for fetchCurrentDevice API (#7737)
Feat (Auth): added docs for fetchCurrentDevice API (#7737)
1 parent 2afa543 commit 4f094c6

File tree

1 file changed

+22
-1
lines changed
  • src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices

1 file changed

+22
-1
lines changed

src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ func forgetDevice() async {
270270
print("Forget device failed with error \(error)")
271271
} catch {
272272
print("Unexpected error: \(error)")
273-
}
273+
}
274274
}
275275
```
276276

@@ -326,6 +326,8 @@ Future<void> fetchAllDevices() async {
326326
```
327327

328328
</InlineFilter>
329+
330+
329331
<InlineFilter filters={["android"]}>
330332

331333
<BlockSwitcher>
@@ -426,6 +428,25 @@ func fetchDevices() -> AnyCancellable {
426428

427429
</InlineFilter>
428430

431+
<InlineFilter filters={["flutter"]}>
432+
433+
## Fetch the current device
434+
435+
You can fetch the current device by using the following:
436+
437+
```dart
438+
Future<void> fetchCurrentUserDevice() async {
439+
try {
440+
final device = await Amplify.Auth.fetchCurrentDevice();
441+
safePrint('Device: $device');
442+
} on AuthException catch (e) {
443+
safePrint('Get current device failed with error: $e');
444+
}
445+
}
446+
```
447+
448+
</InlineFilter>
449+
429450
You can now set up devices to be remembered, forgotten, and fetched.
430451

431452
{/* user agents */}

0 commit comments

Comments
 (0)