# Android request scope with Lock

**URL:** <https://community.auth0.com/t/android-request-scope-with-lock/6495>\
**Category:** Get Help\
**Tags:** android, jwt, lock\
**Created:** [May 5, 2017, 6:40am UTC](https://community.auth0.com/t/android-request-scope-with-lock/6495 "2017-05-05T06:40:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![christophercaroni97](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@christophercaroni97](https://community.auth0.com/u/christophercaroni97)\
**Post date:** [May 5, 2017, 6:40am UTC](https://community.auth0.com/t/android-request-scope-with-lock/6495/1 "2017-05-05T06:40:49Z")

</div>

I followed the [quickstart guide](https://auth0.com/docs/quickstart/backend/java-spring-security/01-authorization) to create a spring boot appliation using spring security and auth0.  
I can get an access token for my resources with Curl using

```
curl --request POST \
  --url 'https://caroni.eu.auth0.com/oauth/token' \
  --header 'content-type: application/json' \
  --data '{"grant_type":"password", "username":"USERNAME_OR_EMAIL", "password":"PASSWORD", "audience":"API_IDENTIFIER", "scope":"read:photos update:photos create:photos", "client_id": "ID", "client_secret": SECRET"
 }'
```

But when I use Lock on Android, how can I can an access token for the `photos` resource? With Curl I get a long jwt but `credentials.getAccessToken()` in the Lock callback is only about a dozen characters long.

---

<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:** [May 16, 2017, 4:06pm UTC](https://community.auth0.com/t/android-request-scope-with-lock/6495/2 "2017-05-16T16:06:44Z")

</div>

For Lock Android (v2) ensure that you use a configuration similar to the following in order to ensure that the request is performed for API authorization and includes the correct scopes:

```
Auth0 auth0 = new Auth0("[client_id]", "[auth0_account_domain]");

auth0.setOIDCConformant(true);

lock = Lock.newBuilder(auth0, callback)
        .withScope("openid read:photos update:photos create:photos")
        .withAudience("https://api.example.com/identifier")
        .build(this);

```

---

<div class="post-metadata">

**Author:** ![christophercaroni97](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@christophercaroni97](https://community.auth0.com/u/christophercaroni97)\
**Post date:** [May 19, 2017, 3:04am UTC](https://community.auth0.com/t/android-request-scope-with-lock/6495/3 "2017-05-19T03:04:09Z")

</div>

@jmangelo you just saved me. Apparently I missed the combination of `setOIDCConformant(true)`and `withAudience()`

---

<div class="post-metadata">

**Author:** ![christophercaroni97](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@christophercaroni97](https://community.auth0.com/u/christophercaroni97)\
**Post date:** [May 19, 2017, 3:04am UTC](https://community.auth0.com/t/android-request-scope-with-lock/6495/4 "2017-05-19T03:04:09Z")

</div>

@jmangelo you just saved me. Apparently I missed the combination of `setOIDCConformant(true)`and `withAudience()`

---

<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:53am UTC](https://community.auth0.com/t/android-request-scope-with-lock/6495/5 "2018-03-02T05:53:43Z")

</div>


