I have a Xamarin Forms app using shell, with IdentityServer4 backend for authentication.
I have a button to log in, when pressed, the user is directed to my IdentityServer as expected to login. After successful login, I'm taken back to my app via the redirect url… but I'm not taken back to the page that I was on (with my login button), I'm taken to the starting page of my app.
What's more, if I press the back button at this point, I'm taken back to my login page... but strangely (maybe not so strange for those that know what is happening), the OnResume event in the App.cs is hit when I press this back button.
Can anyone advise what is going on here? I'd like my app to return to the same page (the login page) and not the start page, seemingly outside the current lifecycle.
Thanks
ps - If it makes a difference, the redirect Uri I am using is from the IdentityServer documentation "io.identitymodel.native://callback"... although I intend to change this when it is working.
It seems this was just an Android problem. I resolved this by setting the LaunchMode on the Main Activity to Single Task... eg
LaunchMode = LaunchMode.SingleTask
[Activity(Label = "MyXamarinApp", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTask, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
...
This returned to my application from where I last left.