]>
Commit | Line | Data |
---|---|---|
0e468546 TM |
1 | # proxmox_login_manager |
2 | ||
10c125d8 | 3 | A basic login management library which handles authentication in combination |
0e468546 TM |
4 | with the proxmox_dart_api_client library. |
5 | ||
6 | You need to build the model classes before using it, to do this use: | |
7 | ```Bash | |
8 | flutter packages pub run build_runner build | |
9 | ``` | |
10 | Basic usage: | |
11 | ```dart | |
12 | ProxmoxLoginSelector( | |
13 | onLogin: (ProxmoxApiClient client) => whatever you want to do with the client, | |
14 | ), | |
15 | ``` | |
16 | This will give you an authenticated ProxmoxApiClient for usage in your project. | |
17 | ||
18 | The latest session will be saved and can be recovered. | |
19 | ```dart | |
20 | loginStorage = await ProxmoxLoginStorage.fromLocalStorage(); | |
21 | final apiClient = await loginStorage.recoverLatestSession(); | |
22 | ``` | |
23 | This will either return an authenticated ProxmoxApiClient or will result in an | |
24 | Exception (ProxmoxApiException). | |
25 | ||
26 | To clear all session on logout you can use: | |
27 | ```dart | |
28 | ProxmoxLoginStorage.fromLocalStorage() | |
29 | .then((storage) => storage?.invalidateAllSessions()); | |
30 | ``` |