# Token Bearer recovery problem by script

**URL:** <https://community.cdata.com/t/token-bearer-recovery-problem-by-script/652>\
**Category:** CData Drivers\
**Tags:** question\
**Created:** [March 6, 2024, 11:06am UTC](https://community.cdata.com/t/token-bearer-recovery-problem-by-script/652 "2024-03-06T11:06:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexTwister77](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/alextwister77/32/2032_2.png) [@AlexTwister77](https://community.cdata.com/u/AlexTwister77)\
**Post date:** [March 6, 2024, 11:06am UTC](https://community.cdata.com/t/token-bearer-recovery-problem-by-script/652/1 "2024-03-06T11:06:36Z")

</div>

Hello everyone ,

I am trying to retrieve a Bearer Token with the GET Bearer Token script on ARC script connector :

 ![35e5f05e-7bf4-4cda-a192-3c2f90db1e15.png](https://us1.discourse-cdn.com/cdata/original/1X/df58f25963629acfc154520d6b3c67cc397bdfa4.png)

Below is my script :

**\<arc:set attr=“http.URL” &nbsp; &nbsp; &nbsp;value=“[https://prodautok.authentication.eu10.hana.ondemand.com/oauth/token?grant\_type=client\_credentials&token\_format=jwt](https://prodautok.authentication.eu10.hana.ondemand.com/oauth/token?grant%5C_type=client%5C_credentials&token%5C_format=jwt)” /\>  
\<arc:set attr=“http.postdata” value=‘{“password”:“XXXXXXX=”,“username”:“sb-21f210cb-9a40-44f8-a78f-c23d13ceec27!b185659|it-rt-prodautok!b117912”}’ /\>  
\<arc:call op=“httpPost” in=“http” out=“response”\>  
&nbsp; \<!-- Pass in the json response that contains the token to jsonOpen. --\>  
&nbsp; \<arc:set attr=“token.text” value=“[http:content]” /\>  
&nbsp; \<arc:call op=“jsonOpen” in=“token” out=“handle”\>  
&nbsp; &nbsp; \<!-- Call jsonDOMGet with the handle that was obtained from jsonOpen. --\>  
&nbsp; &nbsp; \<arc:set attr=“json.handle” &nbsp; &nbsp;value=“[handle.handle]” /\>  
&nbsp; &nbsp; \<arc:set attr=“json.map:token” value=“/json/access\_token” /\>  
&nbsp; &nbsp; \<arc:call op=“jsonDOMGet” in=“json” out=“result” \>  
&nbsp; &nbsp; &nbsp; \<!-- Set the token as a “token” header on the output message. --\>  
&nbsp; &nbsp; &nbsp; \<arc:set attr=“output.header:token” value=“[result.token]” /\>  
&nbsp; &nbsp; \</arc:call\>  
&nbsp; \</arc:call\>  
\</arc:call\>  
\<!-- Push out the original input file. --\>  
\<arc:set attr=“output.filepath” value=“[filepath]” /\>  
\<arc:push item=“output” /\>**

1-When I send a message, I get an error:

401 unauthorized.

I checked URL and password and they are good (I tested on POSTMAN with)

2-Does anyone have a solution or has anyone had this problem before?

Best regards

---

<div class="post-metadata">

**Author:** ![lohith](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/lohith/32/1848_2.png) [@lohith](https://community.cdata.com/u/lohith)\
**Post date:** [March 28, 2024, 9:36am UTC](https://community.cdata.com/t/token-bearer-recovery-problem-by-script/652/2 "2024-03-28T09:36:21Z")

</div>

Hi Alex,

Could you please verify the username and password entered? They appear to be misplaced here; I assume.

```auto
<arc:set attr="http.postdata" value='{"password":"XXXXXXX=","username":"sb-21f210cb-9a40-44f8-a78f-c23d13ceec27!b185659|it-rt-prodautok!b117912"}' />

```

As I side note,&nbsp;Please ensure to select the appropriate category from the dropdown whenever you ask a question. This helps to prevent your question from going unanswered for an extended period.

 ![b42404fb-3d0e-49c2-a5af-f47d07e40eda.png](https://us1.discourse-cdn.com/cdata/original/2X/c/c97c835cbd87167ed164a72b310f952de1f3656e.png)

Always reach out to [arcsupport@cdata.com](mailto:arcsupport@cdata.com)&nbsp;for further assistance.
