Auth0 Home Blog Docs

PhoneGap Custom UI Auth0 login Issue

resource-owner-passw
phonegap

#1

We are trying to implement Auth0 login using Custom UI in our PhoneGap application. We are observing the below issue:

  1. With new accounts we see that the API oauth/ro is deprecated
  2. With Old accounts, we are receiving 400 error

Code:

$.ajax({
                  url: LoginURL,
                  cache: false,
                  method: 'POST',
                  data: {
                      client_id:ClientID,
                      username: uname,
                      password: pwd,
                      connection: 'Username-Password-Authentication',
                      grant_type: 'password',
                      scope: 'openid',
                     // device: '',
                  },
                  headers: {
                      "Content-Type": "application/json",
                  }
           }).success(function (response) { 

Should we install any plugin/or add any configurations to Config.xml?


#2

The usage of oauth/ro endpoint as you showed in your sample snippet has been superseded by performing a resource owner password credentials grant at the /oauth/token endpoint. If you’re interested in specifying a target database connection you should use the extension grant type that support a realm parameter.

In relation to the error itself, you should update your question with additional information as just the status code is insufficient to point to the root cause of the issue. For example, if the uname variable depicted contains an empty string than you would get a 400 error because you would not be specifying a username, however, this is just a guess.


#3

Hi ,
As you suggested ,Tried with following:
https://aravinds.auth0.com/oauth/token
client_id:ClientID,
username: uname,
password: pwd,
grant_type: ‘password’,
scope: ‘openid’,
Got below Error:
{
“error”: “access_denied”,
“error_description”: “Unauthorized”
}

By setting Default directory as Username-Password-Authentication.
We are not using any database.What do we need to set in Default directory?Do we need to do any settings? Please help us.
Thanks.


#4

You’re not providing a client secret so you need to ensure that the client application is not configured to required client authentication at the token endpoint. If it is, then that would explain your error; you can check the Token Endpoint Authentication Method field in the client settings.


#5