Skip to content

A sample Android app that communicates with a non-Google OpenID Connect provider.

Notifications You must be signed in to change notification settings

learning-layers/android-openid-connect

Repository files navigation

OpenID Connect Sample for Android

The app icon with the OpenID logo.

An Android app that communicates with a non-Google OpenID Connect provider.

Please note:
This is currently unmaintained, check out kalemontes/OIDCAndroidLib instead.

Use Google’s own APIs, if you want to connect to their OpenID provider servers. This project is meant to connect to non-Google providers, which those APIs don’t support.

Since OpenID Connect is basically an extension of OAuth 2, it’s convenient to use readily available libraries as the foundation. This is built upon google-oauth-java-client.

Features

  • integration with Android’s AccountManager
  • support for multiple accounts
  • login/authorisation via a WebView
  • refreshing tokens when needed
  • requesting user information
  • making authenticated API calls
  • heavily commented code

Usage

You’ll need to register your app with an OIDC provider and put your configuration data into Config.java.

When you launch the app, you’ll see this:

The app with a button prompting the user to log in.

Tapping the button will let you log in to the provider and authorise the app to use your data.

An Android WebView displaying a provider’s authorisation form.

If all goes well:

  1. the app gets authorisation
  2. the tokens are saved and associated with an account using Android’s AccountManager
  3. the button will indicate that you’ve logged in by displaying your username. (Assuming that the provider has set preferred_username.)

You can add more accounts via Android’s settings. When there are multiple accounts, the app will ask you to choose one of them when logging in.

Dependencies

This project depends on the following libraries. They are fetched automatically via Maven. The last three are for convenience and can probably be written out if needed.

History

This project was originally made to be included in the Ach So! Learning Layers project.

It was developed by Leo Nikkilä at the Learning Environments research group of Aalto University, Finland.

Legalese

Licensed under the MIT licence. See LICENSING.md.

About

A sample Android app that communicates with a non-Google OpenID Connect provider.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages