Xamarin Forms Custom Login For Database Connection

I followed the quickstart tutorial and was able to implement the login functionality in my Xamarin Forms app. However, it uses a web-view to perform the authentication. I was wondering if it is possible to have a native login functionality where I can build a custom login page, send user’s email and password to an Auth0 endpoint, and authenticate the user.

If you’re okay with having the application directly receive and process the user credentials then it is possible (for database users) to authenticate in the way you described. The endpoint you are looking for is the one that provides the resource owner password credentials (ROPC) grant /oauth/token.

Have in mind that the possibility to use the ROPC grant is no longer included by default in new client applications so you’ll have to update the allowed grant types for the client in order to perform this. See Client Grant Types documentation for more context and instructions on how to enable that grant if applicable.

To my knowledge there’s no quickstart in specific to this, but performing a ROPC grant boils down to plain HTTP requests so you can accomplish that with pretty much any HTTP client library.

Thanks @jmangelo for the response. For others who might have this issue, you need to patch your client if it does not allow for http://auth0.com/oauth/grant-type/password-realm as the grant_type. To do so, create an API Explorer in Auth0 Management API (see the screenshot below), grab the token, and patch the client here. You need to provide client_id and body as parameters. You get the first one from you Auth0 dashboard. For the latter, put the following (reference):
{ "grant_types": "password", "http://auth0.com/oauth/grant-type/password-realm" ] }

API Explorer


You can use the Auth0.NET Authentication API to do this for you. See the docs at Documentation

Specifically you can use this method:

Here is some sample code from our integration tests: