Skip to content
This repository has been archived by the owner on Jun 14, 2019. It is now read-only.

fix: don't reset OAuth client state #440

Merged
merged 5 commits into from
Jun 8, 2019

Conversation

zregvart
Copy link
Member

@zregvart zregvart commented Jun 7, 2019

We need to destroy the state received from backend on API call to /api/v1/connectors/{id}/credentials in order for it not to overwrite the cookie received on /api/v1/credentials/callback. This eliminates the need to parse the cookie in oauth-redirect.html and pass/store it in the app.

We need to destroy the state received from backend on API call to
`/api/v1/connectors/{id}/credentials` in order for it not to overwrite
the cookie received on `/api/v1/credentials/callback`. This eliminates
the need to parse the cookie in `oauth-redirect.html` and pass/store it
in the app.
@riccardo-forina
Copy link
Collaborator

PR Storybook available here

Copy link
Collaborator

@riccardo-forina riccardo-forina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the take, now I see the problem!

@@ -97,8 +97,10 @@ export const ConfigurationPage: React.FunctionComponent = () => {
* the API in the document. This cookie will be later used by the BE in the
* redirect page set up in the 3rd party.
*/
if (connectResource) {
if (connectResource && connectResource.state) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see the logic but the fix is not the mutation (never mutate an object in js), but rather wrapping this code in an useEffect to avoid it run on subsequent renders. I can do this in the next few if you want!

@riccardo-forina
Copy link
Collaborator

PR Storybook available here

chore: update the comments to reflect the new improved flow
@riccardo-forina
Copy link
Collaborator

PR Storybook available here

Copy link
Collaborator

@riccardo-forina riccardo-forina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pure-bot
Copy link
Contributor

pure-bot bot commented Jun 8, 2019

Pull request approved by @riccardo-forina - applying approved label

@pure-bot pure-bot bot added the approved label Jun 8, 2019
@pure-bot pure-bot bot merged commit 10f9885 into syndesisio:master Jun 8, 2019
@zregvart zregvart deleted the pr/oauth-flow-fix branch June 8, 2019 18:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants