Protocol Error 401 Unauthorized - Python

Hi!

I apologize if this is a rookie question. I just started working with the infusionsoft api for Python for a Django app that I’ve been building up. I was a little confused on what was going on and how to establish an authorized protocol to get my app to run.

I tried using OAuth with the token I retrieved from the “Grant API access page” on manage my accounts. I was looking at the documentation xml-rpc - Keap Developer Portal (Python section) as well as the Github page for the Python API but couldn’t seem to figure out how to go about this.

TLDR; Can anyone help/guide me on how to authorize my app on Python/Django, remove this error and successfully create a contact? (I’m currently using Jupyter Notebook to test out segments of this code on its own)

Hey, @Naveed_Hussain,

So I don’t know of any Python devs here but I do have a video that covers the principals for the Keap api oauth authentication. The biggest mistake those new to oauth make is that they think the authorization token they get back in the first step is the access token, when in fact, it’s just the token that gives you permission to request the access/refresh token pair. I have a video on all this, but it covers it in PHP. Still, it might help clear up the common mistakes.

Also, you may be able to use the xml-rpc api key method for what you need to do (but that depends on what functionality you need). It’s much simpler to implement than oauth and if it’s just for a single app (not for many others or multiple users) then it would be more straight forward.