Automatically closed - issue fixed for 2 weeks with no activity.
At the moment I am working through the Decoupled Drupal in Practice book. The chapter about authorization kept me stuck the last few days because I was unable to reproduce the steps described about oauth/debug
, Paw and Insomnia were always returning a 403
. At first I thought it was a misconfiguration on my end in Paw/Insomnia. But then I've found:
https://www.drupal.org/project/simple_oauth/issues/3059143 →
(not sure if the issue is exactly related to the one I described in here). Reading through the issue reminded me to switch on the logging for debugging. I was getting access denied
for anonymous(not verified)
user for the location https://mypage.ddev.site/oauth/debug?_format=json
with the following message:
Path: /oauth/debug?_format=json. Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: Internal Server Error in Drupal\jwt\Authentication\Provider\JwtAuth->authenticate() (line 70 of /var/www/html/web/modules/contrib/jwt/src/Authentication/Provider/JwtAuth.php).
- I've tested with Drupal 9.1.0, simple_oauth
5.0.3 and jwt
8.x-1.0-beta5
- Installed simple_oauth
, created a role consumer_app
with the same permissions like the administrator role, created oauth folder at ../oauth
and then clicked the generate keys
button in oauth settings, then created a consumer and added a secret. kept the is confidential
checkbox checked while unchecking the is this consumer 3rd party
.
- Installed jwt
, jwt_auth_consumer
, jwt_auth_issuer
, jwt_path_auth
(I could set up a key for jwt and in jwt configuration set the secret and algorithm afterwards but that isn't necessary for reproduction of the issue so i skipped that part)
- Went into Paw and Insomnia and created a new POST request for http://mypage.ddev.site/oauth/token
. Set grant_type
, client_id
, client_secret
, username
, password
in the body (for username and password I've tested once with the admin user as well as with an authenticated user) -> Each time I get the access token and refresh token returned properly with a 200
.
- Created a new GET request for https://mypage.ddev.site/oauth/debug
. In the header content-type
with application/x-www-form-urlencoded
and Authorization
with Bearer
and the access token
and as URL parameter I've set _format=json
. Now I get a 403
with the error message described in the Problem/Motivation section.
- Now uninstall jwt
, jwt_auth_consumer
, jwt_auth_issuer
, jwt_path_auth
and redo the two requests. Now i get a 200
for the POST
request and a 200
as well for the oauth/debug
GET
request.
- If I reinstall the four Jwt modules (jwt
, jwt_auth_consumer
, jwt_auth_issuer
, jwt_path_auth
) again I immediately run into the same 403
access denied error on each oauth/debug
request again :/
Fixed
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Automatically closed - issue fixed for 2 weeks with no activity.