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

OAuth2 support #6

Open
HeadClot opened this issue Jun 3, 2019 · 3 comments
Open

OAuth2 support #6

HeadClot opened this issue Jun 3, 2019 · 3 comments

Comments

@HeadClot
Copy link

HeadClot commented Jun 3, 2019

Hey bit of a feature request but would it be possible to get OAuth2 support for colyseus-social?

@endel
Copy link
Member

endel commented Jun 3, 2019

Hi @HeadClot, I'd definitely like to add this in the near future. Which client are you using @HeadClot? I hope I can integrate this nicely for Unity3d as well. Cheers!

@HeadClot
Copy link
Author

HeadClot commented Jun 3, 2019

Hey Endel,
That is good to hear that it will be added in the near future.
I am currently using the Unity3D integration for my project.

@endel
Copy link
Member

endel commented Oct 1, 2019

I've started implementing this in the oauth branch today. I'm using the grant package that supports multiple providers via a JSON configuration file containing all the key/secrets of selected providers.

The way it currently works is:

  • User clicks on "authenticate" link, and listens to window.onmessage
  • A new browser window is opened to /connect/:provider, which redirects to the provider login page
  • User authorizes access
  • Browser redirects to /auth/callback, which creates (or associates) the provider into his account, and then send a window.opener.postMessage() containing the user data

To allow a similar behavior on Unity's native builds (desktop, ios, android, etc), I believe the Unity app would need to create an HTTP server (example), and instead of using postMessage(), the final URL in @colyseus/social would send the data through a POST request to the local server Unity has created.

If you have any suggestions or a better alternative please let me know 😅

endel added a commit that referenced this issue Oct 3, 2019
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

2 participants