# PhoneGap Custom UI Auth0 login Issue

**URL:** <https://community.auth0.com/t/phonegap-custom-ui-auth0-login-issue/8527>\
**Category:** Get Help\
**Tags:** phonegap, resource-owner-passw\
**Created:** [October 19, 2017, 7:05pm UTC](https://community.auth0.com/t/phonegap-custom-ui-auth0-login-issue/8527 "2017-10-19T19:05:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aravind.somashekar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aravind.somashekar/32/12742_2.png) [@aravind.somashekar](https://community.auth0.com/u/aravind.somashekar)\
**Post date:** [October 19, 2017, 7:05pm UTC](https://community.auth0.com/t/phonegap-custom-ui-auth0-login-issue/8527/1 "2017-10-19T19:05:38Z")

</div>

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`?

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [October 20, 2017, 7:58pm UTC](https://community.auth0.com/t/phonegap-custom-ui-auth0-login-issue/8527/2 "2017-10-20T19:58:12Z")

</div>

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](https://auth0.com/docs/api-auth/tutorials/password-grant#realm-support).

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.

---

<div class="post-metadata">

**Author:** ![aravind.somashekar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aravind.somashekar/32/12742_2.png) [@aravind.somashekar](https://community.auth0.com/u/aravind.somashekar)\
**Post date:** [October 23, 2017, 7:54pm UTC](https://community.auth0.com/t/phonegap-custom-ui-auth0-login-issue/8527/3 "2017-10-23T19:54:06Z")

</div>

Hi ,  
As you suggested ,Tried with following:  
[https://aravinds.auth0.com/oauth/token](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.

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [October 24, 2017, 8:38pm UTC](https://community.auth0.com/t/phonegap-custom-ui-auth0-login-issue/8527/4 "2017-10-24T20:38:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:57am UTC](https://community.auth0.com/t/phonegap-custom-ui-auth0-login-issue/8527/5 "2018-03-02T05:57:03Z")

</div>


