Auth0 Home Blog Docs

Xamarin Forms issue, not returning to the app after login

I am having some issues implementing the login in xamarin forms. I tried using the example here:

Simplified it to pretty much just login in and returning the token, i then put a break point to see what the token is and it never gets there. It is as if the login page never returns to my app.

Basically i run my : await _auth0Client.LoginAsync();
the app opens a browser and i type in my details, click login and the web site sort of flickers and goes back to itself. I can see that the user has logged in from the dashboard, but it never goes back to my app. If i click login again, it just gives me the “something went wrong” screen from auth0.

Hey there!

Unfortunately it’s not a repo developed by Auth0 and we have no information about it so I’m afraid we as Auth0 team won’t be able to help you with that however maybe someone from our community will be able to give you a helping hand!

Hi Konrad,

I see, i was not aware of that, i used this specific example as you have recommended it as a good sample for xamarin forms implementation.

Is there perhaps a better sample created by Auth0 that i could use?

Hi, I am facing exactly same issue with my visual basic app. any help in the matter will be appreciated

When it comes to Xamarin forms and resources either developed or officially approved by Auth0:

Hi Konrad,

The second link in your list is exactly the one i used for creating my test app. Or to be more precise it was the link i posted at the top and the link to the blog you posted. Those are both created by the same person one based on the other. This is exactly what i am having my issues with. It simply is not working.

Thank you for your other links i will have a look at those.

Sure let me know if that one is somewhat helpful!

Hi Konrad,

I have copied all the code from your sample, first link in your post.
I have gone through the quick start guide to make sure that i am not missing anything. and still it does not work.

The user logs in, the browser even sends the user back to the app after, but the app never gets any response. it just sort of goes back to the “login” screen. I don’t see the welcome message, nor when i put in a break point does it arrive after the Client.LoginAsync();

I don’t know if this is related to the latest version of Xamarin perhaps? i can see that your sample runs on a fairly old version.

That is correct. As this repo lies in our auth0-community org it means that it is no longer actively maintained by Auth0 employees. If you’d like to have it updated then you need to open a pull request for that and this way we can review and potentially merge it.

Hi Konrad,

Having now crated a new blank xamarin app and following the quick start instruction i have again been stopped by exactly the same error.

Perhaps updating the documentation for the latest version of xamarin would be something that would solve this issue?

You’re talking about Daniel-Krzyczkowski repo or the other links I attached?

Our Xamamrin Forms repo which lies under auth0-comunity GitHub org is a repo that was some time ago developed by Auth0 but is no longer actively maintained by us (there’s a note in the repo) due to bandwidth issues in our SDK team. The repo is currently community maintained which means we take a look from time to time and review PRs but that’s not the regular work we put in our other repos.

It might be out of date and some of the things might not be working now due to package versions changes etc. Sorry for the inconvenience!

No i am not referring to those. I was referring to those earlier in the conversation and you have already repeatedly absolved your team of any responsibility of maintaining those the samples and the text of your blog entries.
To be blunt i am not exactly thrilled that you feel that blog entries that are on your web site and have somewhat incorrect or incomplete information are not considered the responsibility of Auth0.
But as it is the case, there is nothing left to do.

However what i am indeed referring to now and in my last post is the quick start guide. Is that also not the responsibility of Auth0 to maintain it with up to date information?

We must have misunderstood ourselves. Let me clear it so that we’re in the same spot:

I have just reached out the the Guest Author (the author of the repo) that you’re using so he can shed some light and help us troubleshoot your hurdle

You need to make sure that you configure iOS and Android correctly or you will not get the callback.

On iOS you need to specify URL types in the info.plist for example You also need
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)

        return true;

The OpenUrl method goes in the AppDelegate for your iOS app.

For Android you need to define an IntentFilter as part of MainActivity.

new[] { Android.Content.Intent.ActionView },
Categories = new[] { Android.Content.Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable },
DataScheme = "", 
DataHost = "",
DataPathPrefix = "/android/")]

Because the intent uses attributes you cannot specific the values as variables or constants. I could not get that working on the app using Auth0. If you have to support multiple environments you will need to use #if statements.

Then as part of the MainActivity you need OnNewIntent method.
protected override void OnNewIntent(Android.Content.Intent intent)

If you are using Xamarin Forms you may want to use a Factory to create the Auth0Client. This allows you to have your login code shared.

1 Like

Thanks a lot for sharing that @rsatter!