# Only Able to get Builtin Client Scopes via Java API

**URL:** <https://forum.keycloak.org/t/only-able-to-get-builtin-client-scopes-via-java-api/3971>\
**Category:** Getting advice\
**Created:** [July 27, 2020, 11:33am UTC](https://forum.keycloak.org/t/only-able-to-get-builtin-client-scopes-via-java-api/3971 "2020-07-27T11:33:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![R4nmaru](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@R4nmaru](https://forum.keycloak.org/u/R4nmaru)\
**Post date:** [July 27, 2020, 11:33am UTC](https://forum.keycloak.org/t/only-able-to-get-builtin-client-scopes-via-java-api/3971/1 "2020-07-27T11:33:15Z")

</div>

When i map custom scopes to builtin mappers. I can easily extract them from the IDToken. But if i do custom mappers with exact same properties it doesnt work.

Whats the difference between builtin mappers and selfcreated mappers?

> ${idToken.phoneNumber}

This works

> ${idToken.test}

This doesnt work

---

<div class="post-metadata">

**Author:** ![R4nmaru](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@R4nmaru](https://forum.keycloak.org/u/R4nmaru)\
**Post date:** [November 27, 2020, 9:28am UTC](https://forum.keycloak.org/t/only-able-to-get-builtin-client-scopes-via-java-api/3971/2 "2020-11-27T09:28:14Z")

</div>

Found a solution:

1. User ${idToken.getOtherClaims()} will give you all Attributes that you added to the Accesstoken

2. Create Java class that extracts the value

> public Boolean test(String x) {

```
   if(x.contains("test=true")==true){
           return true;
   }
   else{
   return false;
   }}

```

1. Final code could look like this. Returns true if test==false and false if test==false

> controller.test(idToken.getOtherClaims().toString())}
