[Zapier Integration] What to put in redirect uri (OAuth)?

Ok I think I have passed the error after changing the “Auth Placement” to "Header as seen below

now I’m getting another error

yes, try openid or all or both.

Also auth placement is in header
Authorization: Bearer {{access_token}}

Note:
You cannot use Administrator account

1 Like

ok thanks. Not getting the error anymore but another error occured

{“message”:“MismatchingRedirectURIError(u’(invalid_request) Mismatching redirect URI. <oauthlib.Request url="http://04d53b49.ngrok.io/api/method/frappe.integrations.oauth2.authorize?response_type=code&client_id=7a29679290&redirect_uri=https%3A%2F%2Fzapier.com%2Fdashboard%2Fauth%2Foauth%2Freturn%2FApp87007API%2F&state=1518963963.3799951\”, http_method="GET", headers="{u\‘Accept-Language\’: u\‘en-US,en;q=0.9\’, u\‘Accept-Encoding\’: u\‘gzip, deflate\’, u\‘X-Forwarded-For\’: u\‘49.146.41.209\’, u\‘Accept\’: u\‘text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8\’, u\‘Upgrade-Insecure-Requests\’: u\‘1\’, u\‘Host\’: u\‘04d53b49.ngrok.io\’, u\‘Cookie\’: u\‘user_image=; system_user=yes; user_id=Administrator; full_name=Administrator; sid=873444756e71eee5ff857f597dfb16e278048be5a6731636dee88434\’, u\‘User-Agent\’: u\‘Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36\’}", body="">',)"}

This is what I did for the redirect uri

  1. my Zapier redirect url is shown below

  2. I put it on my OAuth Client in ERPNext

also put the same URL in Redirect URIs field (Text Field)

1 Like

Sorry, what do you mean by cannot use Admin account? Does this mean I should create the OAuth Client using another Account?

No, You can create OAuth Client using any System Manager Account including Administrator.

You cannot login using Administrator using OAuth. e.g. when you click Sign in with Frappe you can only sign in using non-admin account

1 Like

I see, ok is this what you mean see image below “Confirmation Dialog”

I think my redirect uri is not correctly setup. Redirect uri should be correct first so that this confirmation dialog will appear right?

Still receiving this error:

I have logged out from Administrator already and used another account

{“message”:“MismatchingRedirectURIError(u’(invalid_request) Mismatching redirect URI. <oauthlib.Request url="http://04d53b49.ngrok.io/api/method/frappe.integrations.oauth2.authorize?state=1518966031.1590586&redirect_uri=https%3A%2F%2Fzapier.com%2Fdashboard%2Fauth%2Foauth%2Freturn%2FApp87012API%2F&response_type=code&client_id=7a29679290&data=\”, http_method="GET", headers="{u\‘Accept-Language\’: u\‘en-US,en;q=0.9\’, u\‘Accept-Encoding\’: u\‘gzip, deflate\’, u\‘X-Forwarded-For\’: u\‘49.146.41.209\’, u\‘Accept\’: u\‘text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8\’, u\‘Upgrade-Insecure-Requests\’: u\‘1\’, u\‘Host\’: u\‘04d53b49.ngrok.io\’, u\‘Cookie\’: u\‘user_image=; system_user=yes; user_id=johnvincentfiel%40gmail.com; full_name=johnny; sid=2f0fe96349092b2e4e9d19b868007934447c1113518a38c824760d2c\’, u\‘Referer\’: u\‘http://04d53b49.ngrok.io/login?redirect-to=/api/method/frappe.integrations.oauth2.authorize?state%3D1518966031.1590586%26redirect_uri%3Dhttps%253A%252F%252Fzapier.com%252Fdashboard%252Fauth%252Foauth%252Freturn%252FApp87012API%252F%26response_type%3Dcode%26client_id%3D7a29679290%26data%3D\\’, u\‘User-Agent\’: u\‘Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36\’}", body="">',)"}

What do you mean by “MismatchingRedirectURIError” ?

it checks for exact redirect uri even with trailing / Both default redirect uri and redirect uris fields should be exact

1 Like

Cool, thanks a lot! able to login now. 1 step forward for zapier integration :slight_smile:

2 Likes

Keep sharing updates.
Add to documentation or wiki when you’re done!

3 Likes

sure will do! :slight_smile:

2 Likes

I’m very interested in this integration effort. Please let me know if you need any help with testing.

2 Likes

sure I plan to finish by tomorrow. Will update you guys soon.

Thanks to @Not_a_countant for kickstarting this

4 Likes

I think this integration has a lot of potential for expanding the capabilities of CRM. I currently use Zapier to get email notifications of new leads generated from Facebook ads. If we could get Zapier to integrate calendar and contact information to Gsuite, it would definitely increase the workflow and reminder capabilities of CRM. Another potential use case would be adding LinkedIn user information as the basis for a new lead in CRM.

2 Likes

Just wanted to follow up and see if there’s been an update with the Zapier integration. Please let me know if there’s anything I can do to help out!

Hi we are stuck at sending requests to ERPNext

What happened (You are seeing this because you are an admin):
  Starting POST request to http://c1e6dd81.ngrok.io/api/resource/Sales Invoice
  Received 417 code from http://c1e6dd81.ngrok.io/api/resource/Sales Invoice after 1821ms
  Received content "<!DOCTYPE html>
<!-- Built on Frappe. https://frappe.io/ -->
<html lang="en">
<head>
	<meta charset="
  Unexpected token < in JSON at position 0

Console logs:

Stack trace:
  Object.parse (native)
  Object.promise.then (/var/task/creates/create_invoice.js:56:46)
  bound (domain.js:280:14)
  Object.runBound (domain.js:293:12)
  Object.tryCatcher (/var/task/node_modules/bluebird/js/release/util.js:16:23)
  Promise._settlePromiseFromHandler (/var/task/node_modules/bluebird/js/release/promise.js:512:31)
  Promise._settlePromise (/var/task/node_modules/bluebird/js/release/promise.js:569:18)
  Promise._settlePromise0 (/var/task/node_modules/bluebird/js/release/promise.js:614:10)
  Promise._settlePromises (/var/task/node_modules/bluebird/js/release/promise.js:693:18)
  Async._drainQueue (/var/task/node_modules/bluebird/js/release/async.js:133:16)
  Async._drainQueues (/var/task/node_modules/bluebird/js/release/async.js:143:10)
  Immediate.Async.drainQueues (/var/task/node_modules/bluebird/js/release/async.js:17:14)
  runCallback (timers.js:672:20)
  tryOnImmediate (timers.js:645:5)
  processImmediate [as _immediateCallback] (timers.js:617:5)

Has anyone tried logging/displaying the JSON that is being sent?

Have you tried this? Found this based on the 417 error code.

Hello! I’ll be moving this conversation here Zapier integration with ERPNext - #29 by johnskywalker. Since this (the OAuth) is already solve.