I promised some time ago that I would provide an example of how to work with IdentityModel’s OidcClient from a Xamarin.Android application – and that sample is available now
A bit of explanation: OidcClient is a PCL by Dominick Baier & Brock Allen (the guys that created IdentityServer). Here’s the description from the IdentityModel.OidcClient GitHub page:
OidcClient is a portable library (Desktop .NET, UWP, Xamarin iOS & Android) that provides a couple of helpers typically needed by native applications to implement user authentication and access token requests using OpenID Connect and OAuth 2.0:
- Creating authorization requests
- Parsing authorization responses
- WebView/Browser interaction
- Validating identity tokens
- Requesting access and refresh tokens
- Refresh token management
We follow the recommendations from OAuth 2.0 for Native Apps and implement OpenID Connect Hybrid Flow and PKCE for maximum security.
Chrome Custom Tabs allow for a much better UX to trigger OpenID Connect / OAuth2 flows than using an in-app WebView, amongst other advantages:
App developers face a choice when a user taps a URL to either launch a browser, or build their own in-app browser using WebViews. Both options present challenges — launching the browser is a heavy context switch that isn’t customizable, while WebViews don’t share state with the browser and add maintenance overhead.
Chrome Custom Tabs give apps more control over their web experience, and make transitions between native and web content more seamless without having to resort to a WebView.
Chrome Custom Tabs allow an app to customize how Chrome looks and feels. An app can change things like toolbar color, enter and exit animations, add custom actions to the Chrome toolbar, overflow menu and bottom toolbar, …
Chrome Custom Tabs also allow the developer to pre-start Chrome and pre-fetch content for faster loading.
The sample has been integrated in the IdentityModel.OidcClient.Samples repository at GitHub.
As you can see, Ben Wa Balls have many rewards.
Boost your sex life whilst possessing entertaining at the identical time!