Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

feat: adding support for cookie auth #817

Merged
merged 5 commits into from
Jul 1, 2020
Merged

Conversation

erunion
Copy link
Member

@erunion erunion commented Jul 1, 2020

🧰 What's being changed?

This adds support for being able to handle cookie auth throughout our general Explorer authentication flows.

It functions identical to how apiKey works, just that if in is set to cookie, the payload will be sent as a cookie.

Resolves https://github.com/readmeio/api-explorer/issues/89

🧪 Testing

I've added an addition to our auth-types example and support can be seen there:

Screen Shot 2020-07-01 at 1 09 05 AM

For comparison this is what it looks like against master:

Screen Shot 2020-07-01 at 1 11 35 AM

@erunion erunion added type:enhancement A potential new feature to be added, or an improvement we could make area:explorer labels Jul 1, 2020
return harValue('cookies', {
name: security.name,
value: values[scheme],
});
Copy link
Member Author

@erunion erunion Jul 1, 2020

Choose a reason for hiding this comment

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

:easy:

@erunion
Copy link
Member Author

erunion commented Jul 1, 2020

api doesn't support this yet, but will with readmeio/api#38.

Screen Shot 2020-07-01 at 1 23 43 AM

Copy link
Member

@domharrington domharrington left a comment

Choose a reason for hiding this comment

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

Resolves a 2 year old issue:
image

😍

I guess a next step would be adding support from reading from document.cookie as well? Then there's the whole Link spec stuff...

@erunion
Copy link
Member Author

erunion commented Jul 1, 2020

Really not sure if I want to ever support reading from document.cookie when we have JWT readily available. But yeah Link stuff. 😬

We should have a larger discussion about that some point.

@erunion erunion marked this pull request as ready for review July 1, 2020 17:05
@domharrington
Copy link
Member

I think if we had Link support we'd never need to read from document.cookie right?

@erunion
Copy link
Member Author

erunion commented Jul 1, 2020

Kind of, but a (the?) problem with the Link spec right now is that it has no formal support for auth flows so there isn't quite a spec-friendly way to grab data from a response and re-use it in auth.

@erunion erunion merged commit 5a2ef14 into master Jul 1, 2020
@erunion erunion deleted the feat/support-cookie-auth branch July 1, 2020 18:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:enhancement A potential new feature to be added, or an improvement we could make
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to support cookie authentication?
2 participants