<?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 API Error: invalid code verifier in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-Error-invalid-code-verifier/m-p/523389#M25463</link>
    <description>&lt;P&gt;I'm not having any joy at all getting authorisation to work. As far as I can tell, I'm following the docs to the letter (though some of them are extremely difficult to read or interpret) and this coincides perfectly with the steps outlined in another thread (&lt;A href="https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/What-way-of-authorization-to-use-for-a-PHP-open-source-module/m-p/523387#M1908" target="_blank" rel="noopener"&gt;https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/What-way-of-authorization-to-use-for-a-PHP-open-source-module/m-p/523387#M1908&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to use the PKCE flow for a Wordpress plugin built in PHP. The docs say this is the best method to use where the code will be viewable by the public so you don't want to have your app secret used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I construct a url to take the user to oauth2/authorize to authorise the app. The url has the following added in correct url encoded format:&lt;/P&gt;
&lt;P&gt;response_type=code&lt;/P&gt;
&lt;P&gt;client_id=&amp;lt;MYAPPID&amp;gt;&lt;/P&gt;
&lt;P&gt;code_challenge=&amp;lt;CHALLENGE&amp;gt;&lt;/P&gt;
&lt;P&gt;code_challenge_method=S256&lt;/P&gt;
&lt;P&gt;(with the appropriate values in place of the placeholders above).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The user then returns to my app and types in the &amp;lt;CODE&amp;gt; they're given, and I then save it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I then immediately use that &amp;lt;CODE&amp;gt; to try to get a token using oauth2/token. I'm using CURL for this. The headers I set are:&lt;/P&gt;
&lt;PRE&gt;Accept: application/json
Content-Type: application/x-www-form-urlencoded&lt;/PRE&gt;
&lt;P&gt;Then for the data (sent in urlencoded format) I have&lt;/P&gt;
&lt;PRE&gt;code=&amp;lt;CODE&amp;gt;&lt;BR /&gt;grant_type=authorization_code&lt;BR /&gt;code_verifier=&amp;lt;CHALLENGE&amp;gt;&lt;BR /&gt;client_id=&amp;lt;MYAPPID&amp;gt;&lt;/PRE&gt;
&lt;P&gt;What I get back from Dropbox, though, is an error:&lt;/P&gt;
&lt;PRE&gt;{"error_description": "invalid code verifier", "error": "invalid_grant"}&lt;/PRE&gt;
&lt;P&gt;I keep trying different combinations of things, including with the headers,&amp;nbsp; for about five minutes until the &amp;lt;CODE&amp;gt; expires and the error message changes to that. Then I have to re-authorise the app and circle around again. The encrypted code verifier I'm sending in the token request is exactly the same encrypted code verifier I sent with the authorisation url. So why the error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is doing my head in. Can anyone please help?&lt;/P&gt;</description>
    <pubDate>Mon, 31 May 2021 19:17:20 GMT</pubDate>
    <dc:creator>delahoc</dc:creator>
    <dc:date>2021-05-31T19:17:20Z</dc:date>
    <item>
      <title>API Error: invalid code verifier</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-Error-invalid-code-verifier/m-p/523389#M25463</link>
      <description>&lt;P&gt;I'm not having any joy at all getting authorisation to work. As far as I can tell, I'm following the docs to the letter (though some of them are extremely difficult to read or interpret) and this coincides perfectly with the steps outlined in another thread (&lt;A href="https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/What-way-of-authorization-to-use-for-a-PHP-open-source-module/m-p/523387#M1908" target="_blank" rel="noopener"&gt;https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/What-way-of-authorization-to-use-for-a-PHP-open-source-module/m-p/523387#M1908&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to use the PKCE flow for a Wordpress plugin built in PHP. The docs say this is the best method to use where the code will be viewable by the public so you don't want to have your app secret used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I construct a url to take the user to oauth2/authorize to authorise the app. The url has the following added in correct url encoded format:&lt;/P&gt;
&lt;P&gt;response_type=code&lt;/P&gt;
&lt;P&gt;client_id=&amp;lt;MYAPPID&amp;gt;&lt;/P&gt;
&lt;P&gt;code_challenge=&amp;lt;CHALLENGE&amp;gt;&lt;/P&gt;
&lt;P&gt;code_challenge_method=S256&lt;/P&gt;
&lt;P&gt;(with the appropriate values in place of the placeholders above).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The user then returns to my app and types in the &amp;lt;CODE&amp;gt; they're given, and I then save it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I then immediately use that &amp;lt;CODE&amp;gt; to try to get a token using oauth2/token. I'm using CURL for this. The headers I set are:&lt;/P&gt;
&lt;PRE&gt;Accept: application/json
Content-Type: application/x-www-form-urlencoded&lt;/PRE&gt;
&lt;P&gt;Then for the data (sent in urlencoded format) I have&lt;/P&gt;
&lt;PRE&gt;code=&amp;lt;CODE&amp;gt;&lt;BR /&gt;grant_type=authorization_code&lt;BR /&gt;code_verifier=&amp;lt;CHALLENGE&amp;gt;&lt;BR /&gt;client_id=&amp;lt;MYAPPID&amp;gt;&lt;/PRE&gt;
&lt;P&gt;What I get back from Dropbox, though, is an error:&lt;/P&gt;
&lt;PRE&gt;{"error_description": "invalid code verifier", "error": "invalid_grant"}&lt;/PRE&gt;
&lt;P&gt;I keep trying different combinations of things, including with the headers,&amp;nbsp; for about five minutes until the &amp;lt;CODE&amp;gt; expires and the error message changes to that. Then I have to re-authorise the app and circle around again. The encrypted code verifier I'm sending in the token request is exactly the same encrypted code verifier I sent with the authorisation url. So why the error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is doing my head in. Can anyone please help?&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 19:17:20 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-Error-invalid-code-verifier/m-p/523389#M25463</guid>
      <dc:creator>delahoc</dc:creator>
      <dc:date>2021-05-31T19:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: API Error: invalid code verifier</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-Error-invalid-code-verifier/m-p/523752#M25473</link>
      <description>&lt;P&gt;I see someone already helped you sort this out in another thread. &lt;A href="https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/What-way-of-authorization-to-use-for-a-PHP-open-source-module/m-p/523387/highlight/true#M1908" target="_self"&gt;Here's the link&lt;/A&gt; for anyone else looking for the answer.&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 14:58:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-Error-invalid-code-verifier/m-p/523752#M25473</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-05-31T14:58:58Z</dc:date>
    </item>
  </channel>
</rss>

