Closed leastprivilege closed 8 years ago
:-) Current version of the Chrome Custom Tabs sample can be found here: https://github.com/KevinDockx/IdentityModel.OidcClient.Samples/tree/master/AndroidClientChromeCustomTabs
It's not ready yet, main problem is one specific issue: when the tokens are delivered to the callback URI, they have to be parsed and the Chrome Custom Tab intent should be closed. Can't figure out how to close it; normally, a custom tab is closed by a user action: the close button. But in this case we must close the intent "manually" - must be something simple I'm overlooking. But: I asked a colleague (Xamarin specialist) to help me out, he's going to look into it :-) If anyone else who's reading this has some advice: would be very helpful :)
I looked to your project and I can't find where you register the app's URL (io.identitymodel.native://callback) in the android manifest, Maybe that would close the chrome tab. But that's only my guess.
That's achieved with an intent filter (check out CallbackInterceptorActivity).
Anyway, the problem is solved :) As expected, it was something simple I overlooked: the Chrome Custom Tab intent is closed when you navigate away from it by starting a new activity - so I was missing exactly one line of code. Thanks a lot to @nicovermeir for catching this!
PR coming up :)
Do you have any idea how to combine OIDC with Xamarin Forms? I'm using Prism Framework and I don't know how to move all Android things from Portable (core level) project to Android specific Project as Intent filtering (the navigation is between Pages not intents). IWebView injection is not a problem, but all things regarding redirecting back to Android app get complicated.
There's a Xamarin Forms sample in https://github.com/IdentityServer/IdentityServer3.Samples/tree/master/source/Xamarin, but that one doesn't use OidcClient. It's still OIDC though ;-) Afraid I'm not an Android/Xamarin expert myself... but couldn't you follow the same principles as in the Xamarin.Android Webview or Chrome Custom Tabs sample? If it's the Android-specific code you're looking for, that should be mostly the same I'd think?
WebView sample is available. Chrome Custom Tabs not yet. @KevinDockx ;)