<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: 500 Internal Server Error when trying to get access and refresh token in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251446#M22190</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/85664"&gt;@Suryatapa&lt;/a&gt;&amp;nbsp;, I'm able to reproduce the error with your app. I created another app in your Developer Account that I was able to connect to your test account successfully via OAuth. I'm not sure why that error is occurring at the moment. One working theory is that there were many authorization URLs created for this single app to attempt to connect to HubSpot which could have thrown it off. Is your app installed in any other accounts? If not, I'd suggest making another app in your developer account, and starting fresh.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure that your redirect_uri in your authorization URL does not contain quotation marks.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Feb 2019 19:01:10 GMT</pubDate>
    <dc:creator>cbarley</dc:creator>
    <dc:date>2019-02-07T19:01:10Z</dc:date>
    <item>
      <title>500 Internal Server Error when trying to get access and refresh token</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/250644#M22109</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I had the oauth process working till a fews weeks back - access and refresh tokens were getting updated. But, now if I try to get or refresh tokens I get 500 internal server error. I get the grant code for a new oauth but the subsequent access token generation fails.The same code was working a while back. What could be the reason?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 00:02:13 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/250644#M22109</guid>
      <dc:creator>Suryatapa</dc:creator>
      <dc:date>2019-02-05T00:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: 500 Internal Server Error when trying to get access and refresh token</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/250896#M22130</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/85664"&gt;@Suryatapa&lt;/a&gt;&amp;nbsp;, happy to take a look here. Can you clarify what step exactly you're getting caught up on in the OAuth flow? It sounds like you're getting the 500 error using this endpoint:&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/methods/oauth2/get-access-and-refresh-tokens" target="_blank"&gt;https://developers.hubspot.com/docs/methods/oauth2/get-access-and-refresh-tokens&lt;/A&gt;. If this is the case, can you please provide the following:&lt;/P&gt;
&lt;UL style="list-style-position: inside;"&gt;
&lt;LI&gt;Your App ID&lt;/LI&gt;
&lt;LI&gt;An example request that's failing.&lt;/LI&gt;
&lt;LI&gt;The &lt;EM&gt;full&lt;/EM&gt; error response you're getting from HubSpot's servers.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 20:49:32 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/250896#M22130</guid>
      <dc:creator>cbarley</dc:creator>
      <dc:date>2019-02-05T20:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: 500 Internal Server Error when trying to get access and refresh token</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/250899#M22131</link>
      <description>&lt;P&gt;Thank you for your reply.Please find the below information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;APP Id: 188139&lt;/P&gt;&lt;P&gt;Request Code:&lt;/P&gt;&lt;P&gt;RestTemplate restTemplate = new RestTemplate();&lt;BR /&gt;HttpHeaders headers = new HttpHeaders();&lt;BR /&gt;headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);&lt;BR /&gt;MultiValueMap&amp;lt;String, String&amp;gt; map = new LinkedMultiValueMap&amp;lt;&amp;gt;();&lt;BR /&gt;map.add(“grant_type”,“authorization_code”);&lt;BR /&gt;map.add(“client_id”, MY_CLIENT_ID);&lt;BR /&gt;map.add(“client_secret”,MY_CLIENT_SECRET);&lt;BR /&gt;map.add(“redirect_uri”,“http://localhost:9090/api/v1/projects/newhubspotOauth2redirect");&lt;BR /&gt;map.add(“code”, RECEIVED_GRANT_CODE);&lt;/P&gt;&lt;P&gt;String url = “&lt;A href="https://api.hubapi.com/oauth/v1/token”" target="_blank"&gt;https://api.hubapi.com/oauth/v1/token”&lt;/A&gt;;&lt;BR /&gt;HttpEntity&amp;lt;MultiValueMap&amp;lt;String, String&amp;gt;&amp;gt; request = new HttpEntity&amp;lt;&amp;gt;(map, headers);&lt;BR /&gt;ResponseEntity&amp;lt;String&amp;gt; responseToken = restTemplate.exchange(url, HttpMethod.POST, request,String.class);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last line throws the below error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;org.springframework.web.client.HttpServerErrorException: 500 Internal Server Error&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 21:04:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/250899#M22131</guid>
      <dc:creator>Suryatapa</dc:creator>
      <dc:date>2019-02-05T21:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: 500 Internal Server Error when trying to get access and refresh token</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251077#M22144</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/85664"&gt;@Suryatapa&lt;/a&gt;&amp;nbsp;, that 500 error looks like it's coming from your program. I'll need to see an error coming from HubSpot's servers in order to accurately diagnose the issue. It would also be helpful if I could get the raw request to HubSpot's servers that's causing the error. I won't be able to do much just taking a look at your code without the ability to run it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HubSpot errors follow the format of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;{
&amp;nbsp; &amp;nbsp;status: 'error',
&amp;nbsp; &amp;nbsp;message: MESSAGE HERE,
&amp;nbsp; &amp;nbsp;correlationId: ID HERE,
&amp;nbsp; &amp;nbsp;requestId: ID HERE
}&lt;/PRE&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 15:09:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251077#M22144</guid>
      <dc:creator>cbarley</dc:creator>
      <dc:date>2019-02-06T15:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: 500 Internal Server Error when trying to get access and refresh token</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251168#M22155</link>
      <description>&lt;P&gt;I get the 500 internal error when I make the call using postman as well.&lt;/P&gt;&lt;P&gt;This is the error response:&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"status": "error",&lt;BR /&gt;"message": "internal error",&lt;BR /&gt;"correlationId": "9f174a19-ed9a-457d-98dd-9a2584848d51",&lt;BR /&gt;"requestId": "52ea86605f39eab7f585fb5ccc15747d"&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 18:50:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251168#M22155</guid>
      <dc:creator>Suryatapa</dc:creator>
      <dc:date>2019-02-06T18:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: 500 Internal Server Error when trying to get access and refresh token</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251233#M22159</link>
      <description>&lt;P&gt;Great, thanks! Which endpoint are you using? Can you provide the request that you're making? Make sure you follow the 4 steps outlined &lt;A href="https://developers.hubspot.com/docs/methods/oauth2/oauth2-overview" target="_self"&gt;here&lt;/A&gt;. An example of programmatic fetching of tokens can be found in the&lt;A href="https://developers.hubspot.com/docs/methods/oauth2/oauth2-quickstart" target="_self"&gt; Oauth quickstart guide&lt;/A&gt; as well&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 21:38:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251233#M22159</guid>
      <dc:creator>cbarley</dc:creator>
      <dc:date>2019-02-06T21:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: 500 Internal Server Error when trying to get access and refresh token</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251268#M22161</link>
      <description>&lt;P&gt;&lt;A href="https://app.hubspot.com/oauth/authorize?client_id=1342ad9b-b2b4-4ae5-a9f9-88e9b81a63e0&amp;amp;redirect_uri=" target="_blank" rel="noopener"&gt;https://app.hubspot.com/oauth/authorize?client_id=1342ad9b-b2b4-4ae5-a9f9-88e9b81a63e0&amp;amp;redirect_uri=&lt;/A&gt;&lt;SPAN&gt;“http://localhost:9090/api/v1/projects/newhubspotOauth2redirect"&lt;/SPAN&gt;&amp;amp;scope=contacts%20automation%20content%20business-intelligence%20e-commerce%20files%20forms%20hubdb%20integration-sync%20social%20tickets%20timeline%20actions%20reports&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- This returns a grant code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then the grant code is set in the code i shared earlier to fetch the tokens from&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;https&lt;SPAN class="token punctuation"&gt;:&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;api&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;hubapi&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;com&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;oauth&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;v1&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;token&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;And this process was working fine until it stopped working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering if it is something to do with the test account that is logging in for authentication - maybe it exceeded its no of attempts or something like that.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 07:31:07 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251268#M22161</guid>
      <dc:creator>Suryatapa</dc:creator>
      <dc:date>2019-02-07T07:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: 500 Internal Server Error when trying to get access and refresh token</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251446#M22190</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/85664"&gt;@Suryatapa&lt;/a&gt;&amp;nbsp;, I'm able to reproduce the error with your app. I created another app in your Developer Account that I was able to connect to your test account successfully via OAuth. I'm not sure why that error is occurring at the moment. One working theory is that there were many authorization URLs created for this single app to attempt to connect to HubSpot which could have thrown it off. Is your app installed in any other accounts? If not, I'd suggest making another app in your developer account, and starting fresh.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure that your redirect_uri in your authorization URL does not contain quotation marks.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 19:01:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251446#M22190</guid>
      <dc:creator>cbarley</dc:creator>
      <dc:date>2019-02-07T19:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: 500 Internal Server Error when trying to get access and refresh token</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251507#M22204</link>
      <description>&lt;P&gt;Thanks a lot for all your help!!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 21:48:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Server-Error-when-trying-to-get-access-and-refresh/m-p/251507#M22204</guid>
      <dc:creator>Suryatapa</dc:creator>
      <dc:date>2019-02-07T21:48:27Z</dc:date>
    </item>
  </channel>
</rss>

