# Unable to fetch authorization code in backend code Apex

**URL:** <https://devforum.zoom.us/t/unable-to-fetch-authorization-code-in-backend-code-apex/80494>\
**Category:** Authentication\
**Tags:** api\
**Created:** [December 19, 2022, 12:47pm UTC](https://devforum.zoom.us/t/unable-to-fetch-authorization-code-in-backend-code-apex/80494 "2022-12-19T12:47:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![developer9](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@developer9](https://devforum.zoom.us/u/developer9)\
**Post date:** [December 19, 2022, 12:47pm UTC](https://devforum.zoom.us/t/unable-to-fetch-authorization-code-in-backend-code-apex/80494/1 "2022-12-19T12:47:42Z")

</div>

Hi Team

I am using zoom for the first time for integration and need the authorization code as a response of below endpoint.

Endpoint I am hitting : “[https://zoom.us/oauth/authorize?response\_type=code&redirect\_uri=https://login.salesforce.com&client\_id=Removed](https://zoom.us/oauth/authorize?response_type=code&redirect_uri=https://login.salesforce.com&client_id=Removed)”

In response I get : “System.HttpResponse[Status=Found, StatusCode=302]”

There is no authorization code returned in the response so how do we get it for backend APIs?

Note: If I paste the above endpoint in the browser, I get redirected to the redirect uri with the authorization code in the URL but I need it in the backend as a response of above end point.

Code:

Http h = new Http();  
HttpRequest req = new HttpRequest();  
req.setMethod(‘POST’);  
req.setEndpoint(‘[https://zoom.us/oauth/authorize?response\_type=code&redirect\_uri=https://login.salesforce.com&client\_id=Removed](https://zoom.us/oauth/authorize?response_type=code&redirect_uri=https://login.salesforce.com&client_id=Removed)’);  
HttpResponse hresp = h.send(req);  
System.debug(‘hresp2’+hresp);

---

<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:** [December 19, 2022, 7:42pm UTC](https://devforum.zoom.us/t/unable-to-fetch-authorization-code-in-backend-code-apex/80494/2 "2022-12-19T19:42:55Z")

</div>

@developer9 In order to get the code, someone needs to click on the URL manually. Can you confirm if this is happening?

---

<div class="post-metadata">

**Author:** ![freelancer.nak](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/freelancer.nak/32/40968_2.png) [@freelancer.nak](https://devforum.zoom.us/u/freelancer.nak)\
**Post date:** [December 20, 2022, 2:03pm UTC](https://devforum.zoom.us/t/unable-to-fetch-authorization-code-in-backend-code-apex/80494/3 "2022-12-20T14:03:48Z")

</div>

For OAuth flow please watch 👇

- OAuth [P1](https://youtu.be/LY7jXL9FSqA) & [P2](https://youtu.be/ytkNxMyZ8_E).

You are using C#/Java? Let me know so, that I can also help with that.

---

<div class="post-metadata">

**Author:** ![ranganath.cn14](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@ranganath.cn14](https://devforum.zoom.us/u/ranganath.cn14)\
**Post date:** [January 27, 2023, 8:21am UTC](https://devforum.zoom.us/t/unable-to-fetch-authorization-code-in-backend-code-apex/80494/4 "2023-01-27T08:21:37Z")

</div>

Evan i am getting same response **“System.HttpResponse[Status=Found, StatusCode=302]”**,When i am trying to integrate with Azure devops from salesforce …Could any one please help here to resolve this issue.  
@developer9 did you resolved same issue…?if yes could you please share the solution.

Thanks,

---

<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:** [November 27, 2023, 5:56pm UTC](https://devforum.zoom.us/t/unable-to-fetch-authorization-code-in-backend-code-apex/80494/5 "2023-11-27T17:56:09Z")

</div>

@ranganath.cn14  
Can you provide steps to reproduce your issue?
