Skip to content

Set cookie token on omniauth success to avoid having to store the scraped query param token in the client - #1539

Closed
theblang wants to merge 1 commit into
lynndylanhurley:masterfrom
theblang:master
Closed

theblang wants to merge 1 commit into
lynndylanhurley:masterfrom
theblang:master

Conversation

@theblang

@theblang theblang commented Jun 24, 2022 •

Copy link
Copy Markdown
Contributor

In #1453 we added support for sending and receiving the auth token as a cookie. We're currently working on a de-angularized version of ng-token-auth with cookie support, which means we don't need to store the token in client storage anymore. But I realized that the OAuth flow still requires client storage because the token is scraped from query params, temporarily stored in client storage, then sent to the validate_token call, where a cookie is created. I realized that we could instead just create the cookie immediately in the same place that we're creating the query params in order to avoid having to leak the token in client storage just for that small initial period.

@theblang

theblang commented Jun 24, 2022 •

Copy link
Copy Markdown
Contributor Author

Hey @MaicolBen ! Quick question, I started to write a test for this, but when following the instructions I hit the following error:

Rails couldn't infer whether you are using multiple databases from your database.yml and can't generate the tasks for the non-primary databases. If you'd like to use this feature, please simplify your ERB.

I think this was also mentioned in #1456 . Any ideas of how I should proceed?

@theblang

theblang commented Jul 7, 2022

Copy link
Copy Markdown
Contributor Author

Going to close this PR in favor of opening a new one whose source isn't my fork's master. Need to make a similar additional change for the reset password flow.

@theblang theblang closed this Jul 7, 2022
@theblang

theblang commented Jul 8, 2022

Copy link
Copy Markdown
Contributor Author

See #1542 instead

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

Successfully merging this pull request may close these issues.

1 participant