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

Bugs - Azure B2C - URL char issue #388

Open
massej opened this issue Sep 8, 2023 · 2 comments · May be fixed by #449
Open

Bugs - Azure B2C - URL char issue #388

massej opened this issue Sep 8, 2023 · 2 comments · May be fixed by #449

Comments

@massej
Copy link

massej commented Sep 8, 2023

Hi

This part has a bug

   public function requestUserInfo($attribute = null) {

        $user_info_endpoint = $this->getProviderConfigValue('userinfo_endpoint');
        $schema = 'openid';

        $user_info_endpoint .= '?schema=' . $schema;

        //The accessToken has to be sent in the Authorization header.
        // Accept json to indicate response type
        $headers = ["Authorization: Bearer {$this->accessToken}",
            'Accept: application/json'];

The Azure B2C use this URL for the user endpoint

https://tenant.b2clogin.com/tenant.onmicrosoft.com/openid/v2.0/userinfo?p=b2c_1a_demo_susi_username

But the line
$user_info_endpoint .= '?schema=' . $schema;

should be with & instead.

It cause the problem that it cause a 404 due to trying to get

https://tenant.b2clogin.com/tenant.onmicrosoft.com/openid/v2.0/userinfo?p=b2c_1a_demo_susi_username?schema=openid instead of doing this

https://tenant.b2clogin.com/tenant.onmicrosoft.com/openid/v2.0/userinfo?p=b2c_1a_demo_susi_username&schema=openid

So it there is no ? inside the URL then it should add & instead and it will fix the issue,

Thank you for your help,

@ricklambrechts
Copy link
Contributor

ricklambrechts commented Sep 8, 2023

We could check if there is a ? In the url. If so use &. Thanks!

Do you want to make a PR for this? I can do it also.

@massej
Copy link
Author

massej commented Sep 8, 2023

Thank you @ricklambrechts I just open a pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants