Issue #187
If you use Flutter, then you can access it via people.googleapis.com
endpoint, code uses google_sign_in
library
1 2 3 4 5 6 7 8 9 10 11 12 13
| import 'package:google_sign_in/google_sign_in.dart';
Future<String> getPhotoUrl(GoogleSignInAccount account, String userId) async { final url = 'https://people.googleapis.com/v1/people/${userId}?personFields=photos'; final response = await http.get( url, headers: await account.authHeaders );
final data = json.decode(response.body); return data['photos'].first['url']; }
|
You will get something like
1 2 3 4 5 6
| { resourceName: people/998812322529259873423, etag: %EgQBAzcabcQBAgUH, photos: [{metadata: {primary: true, source: {type: PROFILE, id: 107721622529987673423}}, url: https: }
|
where url is an accessible image url.