Usage of Redirect URI always results in error: Error: Class "League\Uri\UriString" not found

Created on 2 September 2023, 10 months ago
Updated 23 October 2023, 8 months ago

Problem/Motivation

Trying to connect different clients with Drupal as server. Every Client has a different callback URI. The URI entered is always in the format of protocol://redirect_url.domain
Scopes are set

The result is always the same when a client is trying to access
https://domain/oauth/authorize?client_id=clientid&scope=access_token&red...

Error: Class "League\Uri\UriString" not found in League\Uri\Uri::new() (line 426 of /vendor/league/uri/Uri.php)

As soon as I remove the redirect_uri from the URL resulting in https://domain/oauth/authorize?client_id=clientid&scope=access_token&res... the website opens and asks for "allow" or "deny".

Steps to reproduce

Unclear. Drupal installation with several modules.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

6.0

Component

Code

Created by

🇫🇮Finland Nchase

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Nchase
  • 🇦🇺Australia genebobmiller

    Recently hit this issue.

    The cause in my case was the second level dependency league/uri-interfaces which was being installed at version 7.0.0-beta.2.
    uri-interfaces should contain the UriString class but in the beta.2 version it does not.

    We would like to use league/uri-interfaces:7.0.0 but this requires psr/http-message ^1.1 || ^2.0 which is incompatible with drupal/core-recommended:9.5.8.

    ```
    drupal/core-recommended 9.5.8 requires psr/http-message (~1.0.1)
    ```

    For now I'm solving the problem by explicitly locking league/uri to 6.7.0 in my composer.json

    ```
    composer require league/uri:6.7.0
    ```

  • 🇫🇮Finland Nchase

    @genebobmiller - thanks that helped - downgrading to 6.7.0

  • 🇮🇳India Tejas.MCTN

    I have downgraded to 6.7.0 but now it is showing this error:

    League\OAuth2\Server\Exception\OAuthServerException: The resource owner or authorization server denied the request. in League\OAuth2\Server\Exception\OAuthServerException::accessDenied() (line 243 of /my.website.com/public_html/app/vendor/league/oauth2-server/src/Exception/OAuthServerException.php).

    Any idea how to resolve this issue? This all started when I upgraded Drupal core from 9.5.10 to 9.5.11.

  • 🇧🇪Belgium gorkagr

    Hi

    In my case i did as @genebobmiller said (to downgrade and lock on 6.7.0) but alsi I locked league/uri-interfaces to 2.3.0
    Now it works for me

    Thnks

  • 🇬🇧United Kingdom sadikyalcin

    You'll face this problem if you've run `composer update`. Revert to the `composer.lock` before update command and you shall be good.

Production build 0.69.0 2024