Coder Social home page Coder Social logo

curityio / oauth-mobile-web-sso Goto Github PK

View Code? Open in Web Editor NEW
0.0 4.0 1.0 646 KB

Using the nonce authenticator pattern to achieve SSO between a mobile app and a web app

Home Page: https://curity.io/resources/learn/nonce-authenticator-pattern/

License: Apache License 2.0

Shell 5.52% Swift 43.63% Dockerfile 0.22% HTML 0.53% TypeScript 17.09% JavaScript 0.76% CSS 0.26% Kotlin 31.99%
mobile nonce oauth2 openid-connect sso code-example

oauth-mobile-web-sso's Introduction

OAuth Mobile Web SSO Code Example

Demo mobile apps and SPA, to demonstrate the nonce authenticator pattern on a development computer.
This provides an additional Single Sign On (SSO) option between mobile and web apps, to prevent a double login.

Run the Code Example

The following components are called, from a mobile emulator or device.
The SPA and OAuth agent are hosted on the same domain, behind a Docker based reverse proxy.
This ensures that the HTTP-only cookies issued to the SPA are first-party:

Components

Build and deploy the system with the following commands:

./build.sh
./deploy.sh

To enable a setup that works on a standalone computer, an ngrok base URL is used:

The internet base URL is: https://c7b9-2-26-158-168.eu.ngrok.io

Mobile and web apps running on devices or emulators then have full connectivity, over HTTPS URLs.
Backend components use URLs similar to the following values:

Component Internet URL
Web Host https://c7b9-2-26-158-168.eu.ngrok.io/spa
OAuth Agent https://c7b9-2-26-158-168.eu.ngrok.io/oauth-agent
Curity Identity Server Runtime URL https://c7b9-2-26-158-168.eu.ngrok.io

The Curity Identity Server Admin UI is available at https://localhost:6749/admin.
Sign in with credentials admin / Password1 to inspect the OAuth configuration.

Application Flow

Run the mobile client from Android Studio or Xcode, and an unauthenticated view will be shown:

Android iOS

Click the login button and sign in as demouser / Password1.

Android iOS

The authenticated view will then be presented, to enable navigation to the SPA:

Android iOS

The mobile app posts its ID token to the nonce authenticator in order to get a one-time token.
It then passes the nonce in a query string parameter to the SPA, when loading it in a browser.
The SPA then runs an OpenID Connect redirect that authenticates the user automatically, using the nonce:

Android iOS

Website Documentation

See the following resources for further information:

More Information

Please visit curity.io for more information about the Curity Identity Server.

oauth-mobile-web-sso's People

Contributors

gary-archer avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

codedebug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.