Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

[Enhancement] Add support for additional query string parameters to be added to the authorizeEndpoint & logoutEndpoint props #38

@sidm1983

Description

@sidm1983

Hello,

I have recently used react-oauth2-pkce to integrate with an OAuth 2.0 provide called ForgeRock. Everything worked and integrated well. However, in this particular instance of ForgeRock, they had set up multiple login flows and the way to select which flow we wanted to use is to pass in an additional query string parameter to the authorize endpoint (e.g. flow=login2). Looking at the code, there is no way for me the add additional query string parameters to the authorize endpoint as the code adds the query string part and won't account for any query string parameters that may already exist in the authorizeEndpoint prop.

const url = `${logoutEndpoint || `${provider}/logout`}?${toUrlEncoded(query)}`

const url = `${authorizeEndpoint || `${provider}/authorize`}?${toUrlEncoded(query)}`

It would be great if the above lines of code in AuthService.ts didn't hardcode the ? character and instead first tried to detect whether the authorizationEndpoint already has a query string at the end of it. If it has a query string, then the parameters like clientId, scopes, code_challenge can simply be appended to the end. Otherwise, if the authorizationEndpoint (or logoutEndpoint) URL doesn't have a query string, then it adds the ? character first before appending the necessary query string parameters.

Would love to hear your thoughts on this or if there is currently already a way for me to add an additional query string parameter.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions