Problem/Motivation

Even if there are tutorials to setup Oauth 2 authentication, like https://www.youtube.com/playlist?list=PLZOQ_ZMpYrZtqy5-o7KoDhM3n6M0duBjX.

I think having some minimal steps documented will help to improve the usage of the Oauth authentication plugin.

Proposed resolution

Either implements a hook_help in Entity Share Client, or add a dedicated documentation page on https://www.drupal.org/docs/contributed-modules/entity-share about authentication plugins.

CommentFileSizeAuthor
#3 OAuth_setup.txt736 bytesyarik.lutsiuk
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Grimreaper created an issue. See original summary.

yarik.lutsiuk’s picture

Assigned: Unassigned » yarik.lutsiuk
yarik.lutsiuk’s picture

FileSize
736 bytes

Hello,

here is small guide for Oauth authentication setup.

Grimreaper’s picture

Assigned: yarik.lutsiuk » Grimreaper
Status: Active » Needs review
Grimreaper’s picture

Status: Needs review » Needs work

Thanks @yarik.lutsiuk for the documentation.

As seen together, I will complete it to be like a fllow guide without need to think.

Also I got the following error, because of my setup. I guess this is because Guzzle options from settings.php to not verify SSL are not transmitted to the Oauth2 client library.

I will check how to do that.

GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in GuzzleHttp\Handler\CurlFactory::createRejection() (line 201 of /project/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php).
GuzzleHttp\Handler\CurlFactory::finishError(Object, Object, Object) (Line: 105)
GuzzleHttp\Handler\CurlFactory::finish(Object, Object, Object) (Line: 43)
GuzzleHttp\Handler\CurlHandler->__invoke(Object, Array) (Line: 28)
GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object, Array) (Line: 51)
GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object, Array) (Line: 66)
GuzzleHttp\PrepareBodyMiddleware->__invoke(Object, Array) (Line: 29)
GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object, Array) (Line: 70)
GuzzleHttp\RedirectMiddleware->__invoke(Object, Array) (Line: 59)
GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object, Array) (Line: 71)
GuzzleHttp\HandlerStack->__invoke(Object, Array) (Line: 351)
GuzzleHttp\Client->transfer(Object, Array) (Line: 112)
GuzzleHttp\Client->sendAsync(Object, Array) (Line: 129)
GuzzleHttp\Client->send(Object) (Line: 608)
League\OAuth2\Client\Provider\AbstractProvider->getResponse(Object) (Line: 621)
League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(Object) (Line: 537)
League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object, Array) (Line: 307)
Drupal\entity_share_client\Plugin\ClientAuthorization\Oauth->initalizeToken(Object, Array) (Line: 251)
Drupal\entity_share_client\Plugin\ClientAuthorization\Oauth->submitConfigurationForm(Array, Object) (Line: 110)
Drupal\entity_share_client\Form\RemoteForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('remote_edit_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 91)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
require('/project/app/index.php') (Line: 4)
The website encountered an unexpected error. Please try again later.
Grimreaper’s picture

To not forget.

Precise to add the permission "Grant OAuth2 codes" to the role set up in the consumer.

Add a trim on all the configuration fields :) (strange, I thought it was automatic by the form API)

Grimreaper’s picture

Assigned: Grimreaper » yarik.lutsiuk

I have created the following documentation page https://www.drupal.org/docs/contributed-modules/entity-share/authorizati....

If you can give a look for confirmation.

Grimreaper’s picture

Status: Needs work » Needs review
yarik.lutsiuk’s picture

Hello,

looks cool, everything is on point and well described.

Cheers

Grimreaper’s picture

Assigned: yarik.lutsiuk » Unassigned
Status: Needs review » Fixed

Hello @yarik.lutsiuk,

Thanks for the feedback! :)

Status: Fixed » Closed (fixed)

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