# Facing Issues while migrating from JWT app type to ServertoServer OAuth

**URL:** <https://devforum.zoom.us/t/facing-issues-while-migrating-from-jwt-app-type-to-servertoserver-oauth/82625>\
**Category:** API and Webhooks\
**Created:** [February 6, 2023, 7:37am UTC](https://devforum.zoom.us/t/facing-issues-while-migrating-from-jwt-app-type-to-servertoserver-oauth/82625 "2023-02-06T07:37:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanjay.de](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@sanjay.de](https://devforum.zoom.us/u/sanjay.de)\
**Post date:** [February 6, 2023, 7:37am UTC](https://devforum.zoom.us/t/facing-issues-while-migrating-from-jwt-app-type-to-servertoserver-oauth/82625/1 "2023-02-06T07:37:47Z")

</div>

We have our chatbot on zoom but While migrating form JWT App type to Server To Server Oauth I am facing this issue

the below request made to get access token:-

url: `https://zoom.us/oauth/token?grant_type=account_credentials&account_id=accountid`,  
method: ‘POST’,  
headers: {  
‘Authorization’: 'Basic ’ + Buffer.from(‘clientId’ + ‘:’ + ‘client Secret’).toString(‘base64’)  
}

After getting the access token i am using that token to get userDetails by providing their user id  
uri: “[https://api.zoom.us/v2/users/me](https://api.zoom.us/v2/users/me)” + payloadData.payload.userId,  
qs: {  
status: ‘active’  
},  
auth: {  
‘bearer’: body.access\_token  
},  
headers: {  
‘content-type’: ‘application/json’  
},  
json: true //Parse the JSON string in the response

I am successfully getting the response and every thing works fine, but while sending the messgae to particular user from the bot I am  
getting this error:- data: {  
code: 7002,  
message: ‘Invalid robot\_jid specified in the request body.’,  
result: false  
}

==================================================================  
But while using JWT app type i am using the same logic  
 → Generating token using below API:-  
url: `https://api.zoom.us/oauth/token?grant_type=client_credentials`,  
method: ‘POST’,  
headers: {  
‘Authorization’: 'Basic ’ + Buffer.from(config.env.zoom\_client\_id.value + ‘:’ + config.env.zoom\_client\_secret.value).toString(‘base64’)  
}  
 → Then Getting userJID using below Api:-  
uri: “[https://api.zoom.us/v2/users/](https://api.zoom.us/v2/users/)” + emailid,  
qs: {  
status: ‘active’  
},  
auth: {  
‘bearer’: access\_token //geneated uisnf JWT APi key and API secrete key  
},  
headers: {  
‘User-Agent’: ‘Zoom-api-Jwt-Request’,  
‘content-type’: ‘application/json’  
},  
json: true

→ In this everything is working fine end to end , but dont know why it not working in ServertoServer OAuth app type

------\> user:read:admin chat\_message:write:admin imchat:bot chat\_channel:read:admin chat\_message:read:admin }-\> Scope in ServerToServer OAuth  
------\> imchat:bot }-\> Scope defined in Oauth app

---

<div class="post-metadata">

**Author:** ![sanjay.de](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@sanjay.de](https://devforum.zoom.us/u/sanjay.de)\
**Post date:** [February 8, 2023, 6:34am UTC](https://devforum.zoom.us/t/facing-issues-while-migrating-from-jwt-app-type-to-servertoserver-oauth/82625/2 "2023-02-08T06:34:40Z")

</div>

hello team,

any updates?

---

<div class="post-metadata">

**Author:** ![karen.best](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/karen.best/32/46985_2.png) [@karen.best](https://devforum.zoom.us/u/karen.best)\
**Post date:** [March 29, 2023, 9:39pm UTC](https://devforum.zoom.us/t/facing-issues-while-migrating-from-jwt-app-type-to-servertoserver-oauth/82625/3 "2023-03-29T21:39:14Z")

</div>

@all - please respond to this customer please

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [March 30, 2023, 3:53am UTC](https://devforum.zoom.us/t/facing-issues-while-migrating-from-jwt-app-type-to-servertoserver-oauth/82625/4 "2023-03-30T03:53:23Z")

</div>

@karen.best @sanjay.de

apologies for the delay here.

Can you send me the request body? I would like to check at my end.

---

<div class="post-metadata">

**Author:** ![sanjay.de](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@sanjay.de](https://devforum.zoom.us/u/sanjay.de)\
**Post date:** [March 31, 2023, 8:58am UTC](https://devforum.zoom.us/t/facing-issues-while-migrating-from-jwt-app-type-to-servertoserver-oauth/82625/5 "2023-03-31T08:58:44Z")

</div>

```auto
 {
  token: 'eyJhbGciOiJIUzUxMiIsInYiOiIyLjAiLCJraWQiOiI0M2UwNDNkNi02NWU3LTRiNDctYjYzNy0xMjI0ODRkYTVjZGQifQ.eyJ2ZXIiOjgsImF1aWQiOiIwNDZlNTVhNmM4ZDA3NDUwNmEzMzcxOWUwYTRiMjlkZCIsImNvZGUiOiJERS1hQ01IYVNpUzNGOXdwTTk3TzF3czRTM3Y3NUZIb0siLCJpc3MiOiJ6bTpjaWQ6VWozQVBxb0tUajZBS2hjUmpUQ3lBIiwiZ25vIjowLCJ0eXBlIjozLCJhdWQiOiJodHRwczovL29hdXRoLnpvb20udXMiLCJ1aWQiOiIzT2xCTFpycVRpS1lwUFdKVU5RTHR3IiwibmJmIjoxNjgwMjUyOTAxLCJleHAiOjE2ODAyNTY1MDEsImlhdCI6MTY4MDI1MjkwMSwiYWlkIjoiV3QwNlZ6Y1dRXy00cTBfMHV1elMwUSIsImp0aSI6ImRlNDg2MWU1LTY5YTQtNDk1Ni1iMzlmLWNjOWI1NTkwZjRjZSJ9.x3fF0kphRmG2LqmcT4Sq0Eal3j3ubOF-WxiTPlMP3PgO62xrTrjWhQWn4RqvzKTBiT_S_qJ1Pk_k5HMCAQi5vA',
  data: {
    code: 7002,
    message: 'Invalid robot_jid specified in the request body.',
    result: false
  }
}

2023-03-31T08:55:05.211Z Data came in {
  event: 'bot_notification',
  payload: {
    robotJid: 'v1_dl2_bo8tkqbrbaac2mgtg@xmpp.zoom.us',
    toJid: '3olblzrqtikyppwjunqltw@xmpp.zoom.us',
    userJid: '3olblzrqtikyppwjunqltw@xmpp.zoom.us',
    cmd: 'hi',
    accountId: 'Wt06VzcWQ_-4q0_0uuzS0Q',
    userId: '3OlBLZrqTiKYpPWJUNQLtw',
    name: 'Sanjay De',
    channelName: 'Sanjay De',
    userName: 'Sanjay De',
    triggerId: '-g-KpILfTKS3l5rySCbr1w',
    timestamp: 1672048841871
  }
}

```

---

<div class="post-metadata">

**Author:** ![marisa.valdez](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/marisa.valdez/32/47890_2.png) [@marisa.valdez](https://devforum.zoom.us/u/marisa.valdez)\
**Post date:** [April 24, 2023, 5:37pm UTC](https://devforum.zoom.us/t/facing-issues-while-migrating-from-jwt-app-type-to-servertoserver-oauth/82625/6 "2023-04-24T17:37:20Z")

</div>

@ojus.zoom are you able to take a look at this request please?

I appreciate your help!

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [April 26, 2023, 5:24am UTC](https://devforum.zoom.us/t/facing-issues-while-migrating-from-jwt-app-type-to-servertoserver-oauth/82625/7 "2023-04-26T05:24:05Z")

</div>

@sanjay.de @karen.best apologies for the delay on this.

Can you confirm that this is the same robot\_jid that is shown in your app?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [April 28, 2024, 9:00pm UTC](https://devforum.zoom.us/t/facing-issues-while-migrating-from-jwt-app-type-to-servertoserver-oauth/82625/8 "2024-04-28T21:00:12Z")

</div>

Closed on April 28, 2024, 9:00pm UTC

This topic was automatically closed 368 days after the last reply. New replies are no longer allowed.
