Advanced Workflows
OAuth
Logging in with external sites
OAuth is what lets you log in to a service with an existing Google or Facebook account.
Webapp.io customers often need to set a redirect target from their “test app” on an external service to allow logging in to their own accounts.
For this use case, we’ve created the layer-oauth-target.cidemo.co
endpoint,
and the flow looks like this:
- User visits
abcd.cidemo.co
- User clicks “log in with Google”
- User is redirected to a Google login page for a test application
- The “redirect URI” for that login page is “layer-oauth-target.cidemo.co”, so
the user is sent to
layer-oauth-target.cidemo.co/oauth/login?code=hello
layer-oauth-target.cidemo.co
reads a cookie to see which cidemo site the user was last on, so the user is redirected back toabcd.cidemo.co/oauth/login?code=hello
- The application can now read the code and log the user in as usual.
Combining with white-labeled sites (routing)
The same can be done for layer-oauth-target.demo.example.com, in the case where
a route with $branch.demo.example.com
exists.