When attempting to make an API request and authenticating by supplying a bearer token, an exception will be thrown:

Fatal error</b>: Class Drupal\simple_oauth\Authentication\TokenAuthUser contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Drupal\Core\Entity\RevisionableInterface::getLatestRevisionId, Drupal\Core\Entity\RevisionableInterface::isLatestRevision) in <b>/var/www/drupalvm/docroot/modules/contrib/simple_oauth/src/Authentication/TokenAuthUser.php on line 16

I have created a patch which includes the two methods that are required to meet the interface's requirements.

This fault has been reported before* but seems to have only been applied to 8.x-2.x

* https://www.drupal.org/project/simple_oauth/issues/2839585

Comments

damodamodamo created an issue. See original summary.

damodamodamo’s picture

Title: Current HEAD of 8.4.x breaks when authenticating with bearer token » Current HEAD of 8.x-3.x breaks when authenticating with bearer token
e0ipso’s picture

Thanks for your report. What version of core are you using?

damodamodamo’s picture

We are running version 8.4.0

e0ipso’s picture

@damodamodamo thanks for responding. Can you share your call?

damodamodamo’s picture

My request looks like this:

curl -X POST http://drupal-project.api/oauth/token -d "grant_type=client_credentials&client_id=61435b1c-f023-xxxx-xxxx-xxxxxxxx&client_secret=somesecret"

I have enabled both Simple Oauth and Simple OAuth Extras.

e0ipso’s picture

e0ipso’s picture

Status: Active » Postponed (maintainer needs more info)

This fault has been reported before* but seems to have only been applied to 8.x-2.x

You can see how 8.x-3.x contains this code: https://cgit.drupalcode.org/simple_oauth/tree/src/Authentication/TokenAu...

Can you list the version of the module you are using, via composer?

composer info drupal/simple_oauth

e0ipso’s picture

Also welcome to the community @damodamodamo!!

raphael apard’s picture

Version: 8.x-3.0 » 8.x-3.x-dev
StatusFileSize
new2.75 KB

I have a similar error using 3.5 and 3.x-dev :
PHP Fatal error: Class Drupal\\simple_oauth\\Authentication\\TokenAuthUser contains 6 abstract methods and must therefore be declared abstract or implement the remaining methods.

I'm using Drupal 8.5 wit PHP 7.1.7.
composer info drupal/simple_oauth :

name     : drupal/simple_oauth
descrip. : The Simple OAuth module for Drupal
keywords :
versions : * 3.5.0
type     : drupal-module
license  : GPL-2.0+
source   : [git] https://git.drupal.org/project/simple_oauth 8.x-3.5
dist     : [zip] https://ftp.drupal.org/files/projects/simple_oauth-8.x-3.5.zip 8.x-3.5
names    : drupal/simple_oauth
support
source : http://cgit.drupalcode.org/simple_oauth
requires
drupal/consumers *
drupal/core ^8.3
league/oauth2-server ~6.0

Here a patch working for me.

e0ipso’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.28 KB
new3.17 KB

Thanks for the patch @Raphael Apard!

I made some minor changes to it, let's see if it passes the tests.

e0ipso’s picture

Status: Needs review » Fixed
vb’s picture

Please implement getLatestRevisionId() either, error without it

lawxen’s picture

Status: Fixed » Needs work

  • e0ipso committed d10b9d4 on 8.x-3.x authored by Raphael Apard
    Issue #2941522 by e0ipso, Raphael Apard, damodamodamo: Current HEAD of 8...
e0ipso’s picture

Status: Needs work » Fixed

This was not pushed before.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.