Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/parziphal/parse
Browse files Browse the repository at this point in the history
  • Loading branch information
nafplann committed Apr 19, 2018
1 parent f63fa6c commit 50f365c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ $post->useMasterKey(function($post) {
// When creating queries, pass as parameter:
$query = Post::query(true);
// or use the setter method:
$query->userMasterKey(true);
$query->useMasterKey(true);

// Other object methods that accept a $useMasterKey value are:
$post = Post::create($data, true);
Expand Down Expand Up @@ -247,9 +247,11 @@ There are 3 provider drivers available:
* `parse-facebook` which requires users to identify using their Facebook account
* `parse-any` which lets users authenticate with either username/password or Facebook

### Log in with Facebook

You can use the `Parziphal\Parse\Auth\AuthenticatesWithFacebook` trait in your auth controller along with (not instead of) Laravel's `Illuminate\Foundation\Auth\AuthenticatesUsers` trait. The `AuthenticatesWithFacebook` trait has methods to handle Facebook authentication/registration. Just bind the method (or methods) you need to a route and you're ready to go.

Below is the interface of the authentication/registration trait. Note that it can respond in two ways: with a redirection (the \*Redirect methods), or with JSON (the \*Api methods), which will respond with the `$apiResponse` array.
Below is the interface of the authentication/registration trait. Note that it can respond in two ways: with a redirection (the \*Redirect methods), or with JSON (the \*Api methods), which will respond with the `$apiResponse` array, which is there so you can customize it.

```php
trait AuthenticatesWithFacebook
Expand All @@ -272,15 +274,15 @@ trait AuthenticatesWithFacebook
}
```

For Facebook login, the trait expects to find the user's Facebook ID as the `id` parameter, and their access token as the `access_token` parameter.
The trait expects to find the user's Facebook ID as the `id` parameter, and their access token as the `access_token` parameter.

### Username/password registration
### Log in with username/password

There are things to take into consideration regarding this:

* The validator returned by the `validator` method of the registration controller has a `unique` constraint on the `email`, which will trigger database searches, leading to an error; make sure to remove that `unique` constraint.
* The validator returned by the `validator` method of Laravel's default registration controller has a `unique` constraint on the `email` parameter, which will trigger database searches, leading to an error; make sure to remove that `unique` constraint.

* You'll also have to change the `create` method according to your needs. It could look like this (specially if you're using the auth scaffold):
* You'll also have to change the `create` method according to your needs. It could look like this:

```php
protected function create(array $data)
Expand All @@ -295,7 +297,7 @@ protected function create(array $data)
}
```

Remember that on Parse, the `username` field is the login name of the user, so you'll have to store their email under the `username` key if you require users to login using their email.
Notice that the email is stored as the username, this is because on Parse, the `username` field is the login name of the user, so if you require users to login using their email, you'll have to store their email under the `username` key.

## Inspiration from

Expand Down

0 comments on commit 50f365c

Please sign in to comment.