Skip to content

[Question] Client credentials grant in the GenericProvider #1067

@gdbonino

Description

@gdbonino

I am using this library through knpuniversity/oauth2-client-bundle to log in users to my own oAuth2 server. This works great.

The problem I have is that when I want to directly use the Provider configured to get an access token using client_credentials from the command line, the oAuth2 server bounces me.

What I could verify is that when running the command, the redirect_uri does not contain the correct URL as the command does not have the context to generate the URL (Symfony routing). Obviously, a solution would be to set the redirect_uri by hand. But reading the oAuth2 documentation, when using client_credentials, it is not necessary to send redirect_uri.

To solve this, I made a local provider by extending GenericProvider and just overwriting getAccessToken to remove the redirect_uri param when it is client_credentials.

Is what I'm doing correct? If so, I can generate a PR to adjust the functionality directly in GenericProvider.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions