# SOLVED: Revoke token not working in code, only in Postman?

**URL:** <https://devforum.zoom.us/t/solved-revoke-token-not-working-in-code-only-in-postman/6823>\
**Category:** API and Webhooks\
**Created:** [November 26, 2019, 3:35am UTC](https://devforum.zoom.us/t/solved-revoke-token-not-working-in-code-only-in-postman/6823 "2019-11-26T03:35:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![4everCodeNLearn](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/4evercodenlearn/32/2313_2.png) [@4everCodeNLearn](https://devforum.zoom.us/u/4everCodeNLearn)\
**Post date:** [November 26, 2019, 3:35am UTC](https://devforum.zoom.us/t/solved-revoke-token-not-working-in-code-only-in-postman/6823/1 "2019-11-26T03:35:10Z")

</div>

Error ALWAYS returns “reason: Invalid client\_id or client\_secret, error: invalid client”

I’ve successfully implemented getting access and refresh tokens but now I can’t revoke the token in code. It WORKS in Postman however. Can someone see where the error is please or tell me what I am missing?

Here are headers and post field parameters in a PHP/cURL implementation (NOT WORKING):

```
    // Assign the http headers
	$http_headers_array = array
	(
		"Content-Type:application/x-www-form-urlencoded",
	);
	
	// Assign the post fields parameters
	$post_fields_array = array
		(
			"token" => $_SESSION["zoom_access_token"],
			"user" => $zoom_client_id,
			"pass" => $zoom_client_secret
            // "client_id" => $zoom_client_id,
			// "client_secret" => $zoom_client_secret
		);

```

Endpoint: [https://zoom.us/oauth/revoke](https://zoom.us/oauth/revoke)

Tested in Postman and provided the following as the Zoom documentation instructs:

1. [header] Content-Type: application/x-www-form-urlencoded
2. [param] user: (client\_id)
3. [param] pass: (client\_secret)
4. [param] token: (access token)

It WORKS in Postman when I change the parameter names of “user” to “client\_id” and “pass” to “client\_secret”, but it still does not work IN THE CODE when I change it there…how come? Working screenshot is below.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/8/81d86dee1821943e8c9f3dd8ac18f63ca61f3f13.png)

---

<div class="post-metadata">

**Author:** ![4everCodeNLearn](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/4evercodenlearn/32/2313_2.png) [@4everCodeNLearn](https://devforum.zoom.us/u/4everCodeNLearn)\
**Post date:** [November 26, 2019, 5:42am UTC](https://devforum.zoom.us/t/solved-revoke-token-not-working-in-code-only-in-postman/6823/2 "2019-11-26T05:42:35Z")

</div>

**UPDATE: Content-Type needed to be passed in as an array instead of text, like so:**

**"Content-Type" =\> "application/x-www-form-urlencoded"**

**Also, “user” and “pass” was changed to “client\_id” and “client\_secret”. This was a random guess on my part and is not part of the documentation so I guess you could say I got lucky…**

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [November 26, 2019, 5:34pm UTC](https://devforum.zoom.us/t/solved-revoke-token-not-working-in-code-only-in-postman/6823/3 "2019-11-26T17:34:02Z")

</div>

Hey @4everCodeNLearn,

Glad you solved your issue, although setting the client\_id and the client\_secret should be done in the headers/auth headers the same way as when [requesting an access token](https://marketplace.zoom.us/docs/guides/authorization/oauth/oauth-with-zoom#request-access-token). We do not recommend putting your client\_secret in the url as a query param.

Request Headers:

```auto
{
   "Authorization": "Basic base64Encode(client_id:client_secret)"
}

```

In the [Node.js revoke token code example on our docs](https://marketplace.zoom.us/docs/guides/authorization/oauth/oauth-with-zoom#revoke-access-token), using the [request library](https://github.com/request/request#http-authentication), the auth object sets a header with the base 64 encoded client\_id:client\_secret behind the scenes, similar to how postman does on the Authorization tab \> Basic option.

 ![57 AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/4/444b3fbad8298ebaaaa1abba66dc69bb20055e5e.png)

```auto
auth: {
     'user': 'Odet7ldYQjyagzLKzNomA',
     'pass': 'UeE0e7LZopJRFityw1h3b7dJFz29IeY7'
}

```

We will work on making this more clear in our docs.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![4everCodeNLearn](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/4evercodenlearn/32/2313_2.png) [@4everCodeNLearn](https://devforum.zoom.us/u/4everCodeNLearn)\
**Post date:** [November 27, 2019, 6:10am UTC](https://devforum.zoom.us/t/solved-revoke-token-not-working-in-code-only-in-postman/6823/4 "2019-11-27T06:10:04Z")

</div>

> [@tommy](#):
>
> “Authorization”: “Basic base64Encode(client\_id:client\_secret)”

I will add this update. Thanks, Tommy.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [November 27, 2019, 5:13pm UTC](https://devforum.zoom.us/t/solved-revoke-token-not-working-in-code-only-in-postman/6823/5 "2019-11-27T17:13:35Z")

</div>

Happy to help! 🙂

-Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 7:05pm UTC](https://devforum.zoom.us/t/solved-revoke-token-not-working-in-code-only-in-postman/6823/6 "2020-08-21T19:05:31Z")

</div>

Closed on August 21, 2020, 7:05pm UTC


