# Error calling API Settings in App

**URL:** <https://community.dynatrace.com/t/error-calling-api-settings-in-app/41974>\
**Category:** Developer Q&A Forum\
**Tags:** custom-app\
**Created:** [October 7, 2023, 10:25pm UTC](https://community.dynatrace.com/t/error-calling-api-settings-in-app/41974 "2023-10-07T22:25:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joseafcampos](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@joseafcampos](https://community.dynatrace.com/u/joseafcampos)\
**Post date:** [October 7, 2023, 10:25pm UTC](https://community.dynatrace.com/t/error-calling-api-settings-in-app/41974/1 "2023-10-07T22:25:33Z")

</div>

I’m testing a dynatrace App in React. I’ve a hook that is calling Settings API through TypeScript SDK as you can see on the code snippet:

try {&nbsp; &nbsp; &nbsp; var config = {“schemaIds”:“builtin:alerting.maintenance-window”,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; “scopes”:“environment”}&nbsp; &nbsp; &nbsp; const response = await settingsObjectsClient.getSettingsObjects(config);&nbsp; &nbsp; &nbsp; console.log(response);…&nbsp; &nbsp; } catch (e) {…&nbsp; &nbsp; }But I get the following error in the browser:SyntaxError: Unexpected token ‘O’, “OAuth token”… is not valid JSON  
at JSON.parse (\<anonymous\>)  
at fetchQuery ([http://localhost:3002/ui/main.js:123265:36](http://localhost:3002/ui/main.js:123265:36))And&nbsp; in the console I have this message:Request failed: {“code”:403,“message”:“OAuth token is missing required scope. Use one of: [settings:objects:read]”}I’ve executed the same code in a notebook and there was no problem. So It seams that when I call the same API from React APP, the typescript SDK is not passing the login user authorization token.

---

<div class="post-metadata">

**Author:** ![stefan\_eggersto](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/stefan_eggersto/32/34114_2.png) [@stefan\_eggersto](https://community.dynatrace.com/u/stefan_eggersto)\
**Post date:** [October 9, 2023, 5:22am UTC](https://community.dynatrace.com/t/error-calling-api-settings-in-app/41974/2 "2023-10-09T05:22:03Z")

</div>

Hi&nbsp;[@joseafcampos](https://community.dynatrace.com/user/54362)&nbsp;,

to access the Settings API from your app, you need to add the scope `settings:objects:read` to your app config file. You can find the instructions at&nbsp;[Add permission scopes to use Dynatrace APIs | Dynatrace Developer](https://developer.dynatrace.com/develop/security/add-scopes/)

---

<div class="post-metadata">

**Author:** ![joseafcampos](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@joseafcampos](https://community.dynatrace.com/u/joseafcampos)\
**Post date:** [October 12, 2023, 1:09pm UTC](https://community.dynatrace.com/t/error-calling-api-settings-in-app/41974/3 "2023-10-12T13:09:46Z")

</div>

Thank you, that fixed the problem.
