Skip to content

Add google login helper #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -658,6 +658,24 @@ Other user features are:-
}
```

For Google and the example below, we used the library provided at https://pub.dev/packages/google_sign_in

```
class OAuthLogin {
final GoogleSignIn _googleSignIn = GoogleSignIn( scopes: ['email', 'https://www.googleapis.com/auth/contacts.readonly'] );

sigInGoogle() async {
GoogleSignInAccount account = await _googleSignIn.signIn();
GoogleSignInAuthentication authentication = await account.authentication;
await ParseUser.loginWith(
'google',
google(_googleSignIn.currentUser.id,
authentication.accessToken,
authentication.idToken));
}
}
```

## Security for Objects - ParseACL
For any object, you can specify which users are allowed to read the object, and which users are allowed to modify an object.
To support this type of security, each object has an access control list, implemented by the __ParseACL__ class.
8 changes: 8 additions & 0 deletions lib/src/utils/parse_login_helpers.dart
Original file line number Diff line number Diff line change
@@ -7,3 +7,11 @@ Map<String, dynamic> facebook(String token, String id, DateTime expires) {
'expiration_date': expires.toString()
};
}

Map<String, dynamic> google(String token, String id, String idToken) {
return <String, dynamic>{
'access_token': token,
'id': id,
'id_token': idToken
};
}