Oauth2 and ionic - one solution for desktop and mobile


#1

Hi there, I’m very new to OAuth2. I’ve been reading posts in the forum on how to do OAuth2 logins and was wondering if there is a common approach that will work on both mobile and desktop ports (I use electron).

The need:
a) My app uses a sign in to a proprietary server for home security surveillance. This is an open source software that people install in their own servers. Lets call this URL https://mysecurityserver.ddns.net

b) Some of my users have an oauth2 proxy in front of it, I need to navigate first. In other words, if my app does a $http to https://mysecurityserver.ddns.net it first presents this oauth GW with a “login via google” (one of the providers that can be configured). Once I press that, a windows pops up for credentials and then I am taken to the actual login for https://mysecurityserver.ddns.net that I need

c) If it helps, I did snoop the network. It seems when I “login with google” and that popup login credentials shows up, messages of consent etc. are exchanged with google and eventually, a “callback” URL is invoked on the server like https://mysecurityserver.ddns.net/oauth2/callback and all subsequent request/responses have a oauth2_proxy cookie set. This is what I need to replicate as I understand Oauth2 seems to have multiple flows (or so I think)

Is there a way I can handle this oauth login easily in a way that works both in web and mobile? I’ve seen multiple plugins for mobile (which use inappbrowser) and various other plugins for pure angularJS as well. Ideally I’d like to do this on app start and “JustFuggetAboutIt™” for the rest of my app so my existing http requests et al work.

Any easy “hey, here is a dummies guide” approaches?