Fix auth
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:label="bmmanager"
|
||||
android:name="${applicationName}"
|
||||
|
||||
@@ -9,14 +9,27 @@ import 'brandmeister_client.dart';
|
||||
class AuthenticationManager extends ChangeNotifier {
|
||||
static const String _tokenKey = 'apiToken';
|
||||
|
||||
final FlutterSecureStorage _storage = const FlutterSecureStorage(
|
||||
late final FlutterSecureStorage _storage;
|
||||
|
||||
AuthenticationManager() {
|
||||
_initStorage();
|
||||
_loadToken();
|
||||
}
|
||||
|
||||
void _initStorage() {
|
||||
_storage = const FlutterSecureStorage(
|
||||
aOptions: AndroidOptions(
|
||||
encryptedSharedPreferences: true,
|
||||
),
|
||||
iOptions: IOSOptions(
|
||||
accessibility: KeychainAccessibility.first_unlock,
|
||||
),
|
||||
webOptions: WebOptions(
|
||||
dbName: 'bmmanager',
|
||||
publicKey: 'bmmanager_public_key',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool _isAuthenticated = false;
|
||||
String _apiToken = '';
|
||||
@@ -27,10 +40,6 @@ class AuthenticationManager extends ChangeNotifier {
|
||||
String get apiToken => _apiToken;
|
||||
UserInfo? get userInfo => _userInfo;
|
||||
|
||||
AuthenticationManager() {
|
||||
_loadToken();
|
||||
}
|
||||
|
||||
Future<void> _loadToken() async {
|
||||
try {
|
||||
final token = await _storage.read(key: _tokenKey);
|
||||
|
||||
@@ -8,5 +8,11 @@
|
||||
<true/>
|
||||
<key>com.apple.security.network.server</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>$(TeamIdentifierPrefix)io.kida.bmmanager</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -4,5 +4,11 @@
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>$(TeamIdentifierPrefix)io.kida.bmmanager</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
Reference in New Issue
Block a user