title: Connecting to Paypal Rest Api to obtain users consent
body: <p>I am trying to connect to Paypal to get a users consent to access their paypal payment history.  The end goal would be to download payments received at the end of the day and take the info and dump it into a local database.</p>
  
  <p><a href="https://developer.paypal.com/webapps/developer/docs/api/#obtain-users-consent" rel="nofollow">https://developer.paypal.com/webapps/developer/docs/api/#obtain-users-consent</a></p>
  
  <pre><code>&lt;Cfset returnlink="http://www.xxxxxx.com/paypal/paypalreturn.cfm"&gt;
  
  &lt;cfset paypalLink="https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize"&gt;
  &lt;Cfset paypallink="#paypallink#?client_id=#settingsLive.clientid#"&gt;
  &lt;Cfset paypallink="#paypallink#&amp;redirect_uri=#urlencodedformat(returnlink)#"&gt;
  &lt;Cfset paypallink="#paypallink#&amp;response_type=code"&gt;
  &lt;Cfset paypallink="#paypallink#&amp;scope=profile+email+address+phone+https%3A%2F%2Furi.paypal.com%2Fservices%2Fpaypalattributes"&gt;
  &lt;cfset paypalLink="#paypallink#&amp;nonce=#createUUID()#"&gt;
  &lt;cfset paypalLink="#paypallink#&amp;state=create"&gt;
  
  
  &lt;a href="&lt;cfoutput&gt;#paypalLink#&lt;/cfoutput&gt;"&gt;Login with paypal&lt;/a&gt;
  </code></pre>
  
  <p>Clicking on the link below returns:</p>
  
  <blockquote>
    <p>Relying Party Validation error: redirect_uri provided in the request
    does not match with the registered redirect_uri. Please check the
    request.</p>
  </blockquote>
  
  <p>I have logged into the Rest API, modified my app and made sure the redirect uri's for the test and live return link match that listed above.  I have also made sure that the accept logins options are checked.</p>
  
  <p>I have also tried the same code against their sandbox URL:</p>
  
  <pre><code>https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize
  </code></pre>
  
  <p>and instead of receiving the validation error, I get a page cannot be displayed.</p>
  
  <p>I've tried every combination of things that I could think of
  1) removing 1 cfset statement at a time to isolate a bad variable
  2) making sure the return uri was a https vs http
  3) switching to sandbox mode url and back</p>
  
  <p>I've connected to other oauth2 api's in the past, but can't figure this one out.</p>