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

Add state support #17

Merged
merged 2 commits into from
Jul 12, 2017
Merged

Add state support #17

merged 2 commits into from
Jul 12, 2017

Conversation

johnf
Copy link
Contributor

@johnf johnf commented Apr 26, 2017

Add state support as per http://www.twobotechnologies.com/blog/2014/02/importance-of-state-in-oauth2.html

One of the services I was dealing with needed this.

Hard work here completed by @javikr

@mawie81
Copy link
Owner

mawie81 commented May 4, 2017

Thanks for the PR. I´m still not sure if I understand this correctly: Sending a random state param is fine. But wouldn´t it also be required to validate the param that gets send back by the server?

@johnf
Copy link
Contributor Author

johnf commented May 5, 2017

@mawie81 you're probably right. Let me take a look over the weekend. The above patch makes it work where state is required by the provider but you're right it probably won't actually implement what's needed.

@johnf
Copy link
Contributor Author

johnf commented May 6, 2017

So I'm no expert here. I have done a bunch of reading

So normally you would have following flow in a Saas setup say.

  • Server sends the token request from oauth provider including a state
  • redirects web browser to oauth provider with the token
  • Provider then then redirects the client back to the server with the state in the callabck
  • Server then validates it is the same it sent in the first place

In electron's case, electron is doing this all at an API level it is effectively the server and the client. So I think we can safely send the state and not care about what we get back?

So from my reading up on this, all a client has to do is send a random state. The state is then passed through the backend servers and then via the callback for validation.

I have had a look at a bunch of other oauth clients on NPM and they seem to do the same thing. Just create a random state and send it.

@johnf
Copy link
Contributor Author

johnf commented Jul 8, 2017

Any change of getting this merged and a new release?
Let me know if I can help in any way.

@mawie81 mawie81 merged commit 9ea2773 into mawie81:master Jul 12, 2017
@mawie81
Copy link
Owner

mawie81 commented Jul 12, 2017

Merged and published as 3.0.0
Thanks for the reminder :)

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

Successfully merging this pull request may close these issues.

3 participants