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

Open
sidm1983 opened this issue Feb 11, 2022 · 1 comment

Comments

@sidm1983
Copy link

sidm1983 commented Feb 11, 2022

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.

@sidm1983 sidm1983 changed the title Add support for additional query string parameters to be added to the authorizeEndpoint & tokenEndpoint props [Enhancement] Add support for additional query string parameters to be added to the authorizeEndpoint & tokenEndpoint props Feb 11, 2022
@sidm1983 sidm1983 changed the title [Enhancement] Add support for additional query string parameters to be added to the authorizeEndpoint & tokenEndpoint props [Enhancement] Add support for additional query string parameters to be added to the authorizeEndpoint & logoutEndpoint props Feb 11, 2022
@sidm1983
Copy link
Author

I just looked at the list of active pull requests, and it looks like someone has already added this enhancement. Pull request #28 is what I need to be able to pass in a custom querystring parameter into the authorizationEndpoint prop.

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

No branches or pull requests

1 participant