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

connect client to server type generic #421

Open
cointreau17 opened this issue Nov 17, 2023 · 0 comments
Open

connect client to server type generic #421

cointreau17 opened this issue Nov 17, 2023 · 0 comments

Comments

@cointreau17
Copy link

cointreau17 commented Nov 17, 2023

I am trying to configure oauth2-client-bundle 2.16 in symfony 6.3 to connect to a generic oauth2 server Laravel passport 11. After several configurations my problem now is that I need the request to this route to be made by METHOD_POST

Symfony oauth2-client-bunle generates this route:

http://localhost:8080/oauth/authorize?scope=public_profile%20email&state=d9048e90eb368f4b6258128ac171aa9&response_type=code&approval_prompt=auto&redirect_uri=http%3A%2F%2Flocalhost%3A8081%2Fconnect%2Fpassport%2Fcheck&client_id=1

This route works if I request it with Inmomnia using POST METHOD adding a header with my client_secret in base64 and I get the passport login page:

Authorization: Basic base_64_client_secret <----Is my header

My controller is

/**
 * @Route("/connect/passport", name="connect_passport_start")
 */
public function connectAction(ClientRegistry $clientRegistry)
{
    // on Symfony 3.3 or lower, $clientRegistry = $this->get('knpu.oauth2.registry');

    // will redirect to passport server
    return $clientRegistry
        ->getClient('passport_oauth') // key used in config/packages/knpu_oauth2_client.yaml
        ->redirect([
            'public_profile', 'email' // the scopes you want to access
        ]);
}

How can I do to request from my Symfony endpoitn http://localhost:8081/connect/passport get succersfully redirection with METHOD_POST to http://localhost:8080/oauth/authorize?scope... endpoint?

Is this thee correct way to create my client?

Please help me, if you need more code I can add it.

Thanks!

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

No branches or pull requests

1 participant