auth0 / Xamarin.Auth0Client

This library has been deprecated. See README for more info
MIT License
22 stars 41 forks source link

using web API instead of SDK #27

Closed percepticon closed 7 years ago

percepticon commented 7 years ago

Hi Experts, I know this forum is for the SDK but I have nowhere else to turn. hoping someone here can help. Why am I doing it this way? Because my XF app is a PCL based and I don't want to deal with making a renderer just to pull this off when the API should suffice for my needs. That said... I'm calling the RESTAPI using Xamarin Forms. Even though my response to the oauth/ro is 200 ok, it doesn't return the id_token..only the access_token. Do I need to specify a CORS url when calling from the iOS emulator? Ironically, it works perfectly from Postman.

Any help appreciated..

Many Thanks

percy

jerriep commented 7 years ago

Hi @percepticon

The /oauth/ro endpoint is being deprecated. Please use the new Resource Owner Password flow on the oauth/token endpoint: https://auth0.com/docs/api/authentication#resource-owner-password

In .NET applications you can use the Auth0.NET SDK: https://github.com/auth0/auth0.net

Docs are over here: http://auth0.github.io/auth0.net/

Here is some sample code:

var api = new AuthenticationApiClient("yourdomain.auth0.com");

var tokenResponse = await api.GetTokenAsync(new ResourceOwnerTokenRequest
{
    ClientId = "your client id",
    ClientSecret = "your client secret",
    Username = "user@sample.com",
    Password = "password"
});