Skip to content

gary-archer/oauth.mobilesample.android

Repository files navigation

Android OAuth Mobile Sample

Codacy Badge

Overview

A demo mobile app using OpenID Connect, which aims for the best usability and reliability.

Views

The app is a simple UI with some basic navigation between views, to render fictional investment resources.
Its data is returned from an OAuth-secured API that uses claims-based authorization.
The app uses user attributes from both the OpenID Connect userinfo endpoint and its API.

App Views

Local Development Quick Start

Open the app in Android Studio and run the app on an emulator or device.
This triggers an OpenID Connect code flow to authenticate the user with the AppAuth pattern.
Logins run in a Chrome Custom Tab browser and the app cannot access the user's credentials:

App Login

You can login to the app using my AWS Cognito test account:

- User: [email protected]
- Password: GuestPassword1

The app receives the login response using a claimed HTTPS scheme redirect URI, in the most secure way.
Android App Links enables the claimed HTTPS scheme redirect URI and requires a cloud hosted deep linking assets file.
Interstitial web pages ensure a user gesture after login and logout, so that responses return to the app reliably.
After login you can test all lifecycle operations, including token refresh, expiry events and logout.

Further Information

Programming Languages

  • The app's code uses Kotlin and its views use Jetpack Compose.

Infrastructure

  • AppAuth-Android implements the code flow with PKCE.
  • AWS Serverless or Kubernetes host remote API endpoints that the app calls.
  • AWS Cognito is the default authorization server for the mobile app and API.
  • Android shared preferences stores tokens on the device and isolates this data from other apps.
  • AWS S3 and Cloudfront serve mobile deep linking asset files and interstitial web pages.

About

Final OpenID Connect secured Android Mobile Code Sample

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published