Skip to content
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

Prevent access token for anonymous users #987

Open
wants to merge 2 commits into
base: 7.x-1.x
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public static function controllersInfo() {
public function getOrCreateToken() {
$entity_type = $this->getEntityType();
$account = $this->getAccount();

if (!$account->uid) {
// If this handler was called programmatically we want to make sure the
// account is of an authenticated user.
throw new RestfulBadRequestException('Only authenticated users can have an access token.');
}

// Check if there is a token that did not expire yet.
$query = new EntityFieldQuery();
$result = $query
Expand Down