Пытаюсь подключиться к google photos rest api with flutter (iOS APP) и получаю сообщение об ошибке: {"error": {"code": 403, "message": "В запросе недостаточно областей проверки подлинности.","status": "PERMISSION_DENIED"}
код:
mixin LoginModel on ConnectedPhotosModel {
//temory login
bool get isLoggedIn => _isLoggedIn;
GoogleSignInAccount _currentUser;
GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: <String>[
'email',
'https://www.googleapis.com/auth/drive.photos.readonly',
],
);
GoogleSignInAccount get currentUser {
return _currentUser;
}
void isSignedIn() {
_googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount account) {
_currentUser = account;
if (_currentUser != null) {
_currentUser.authHeaders.then((result) {
// print(r['Authorization']);
getAlbumsz(result['Authorization']);
});
// userLogin();
}
});
_googleSignIn.signInSilently();
notifyListeners();
}
Future<Null> getAlbumsz(String barear) async {
return http.get('https://photoslibrary.googleapis.com/v1/albums', headers: {
'Content-Type': 'application/json',
'Authorization': '$barear'
}).then<Null>((http.Response response) {
print(response.statusCode);
print(response.body);
print('yes mama');
}).catchError((error) {
print(error);
});
}
//contact code was here....
Future<void> handleSignIn() async {
try {
await _googleSignIn.signIn();
} catch (error) {
print(error);
}
notifyListeners();
}
Future<void> handleSignOut() async {
_googleSignIn.disconnect();
_currentUser = null;
notifyListeners();
}
//Temporary login
void userLogin() {
_isLoggedIn = !_isLoggedIn;
notifyListeners();
}
}
Можно ли использовать идентификаторы клиента iOS OAuth 2.0 с REST-API google-photos ??