Skip to content

redirect_uri in redirects' targetUrl not returning https #436

@tacman

Description

@tacman

After too many hours of hacking, I discovered that the redirect that comes back is sometimes using http, not https.

Curiously, for me it's happening on production, but not locally.

Here's my solution, but surely there's a better way.

        $client = $this->clientRegistry->getClient($clientKey); // key used in config/packages/knpu_oauth2_client.yaml
        $redirect = $client->redirect($scopes[$clientKey] ?? [], ['state' => $client->getOAuth2Provider()->getState()]);
        // assert(str_starts_with('https://', $redirect->getTargetUrl());
        $redirect->setTargetUrl(str_replace('http%3A', 'https%3A', $redirect->getTargetUrl()));
        return $redirect;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions