Expand my Community achievements bar.

Analytics API 2 - OAuth in Python

Avatar

Level 3

I'm writing a utility script in Python (in a Jupyter notebook) which transfers all AA assets for users leaving our organisation to a holding user. Most of it works fine using JWT authentication, but some API endpoints return an error saying "only Company Admins are allowed to access this endpoint". As I don't want to promote my API to being a Company wide Admin and confirming it works if I use an OAuth token (obtained via the playground) for my personal logon, I thought I'd switch the authentication to OAuth so any of the company admins could use it. However I'm running into problems.

 

There's plenty of examples of how to do OAuth if you're building a web app and are already using things like Flask, but I've not been able to get anything to work in the notebook (or in a locally running script). My ideal flow would be the same as I've implemented for accessing the Google APIs via OAuth (using the google_auth_oauthlib flow library):

  1. The user runs the python cell that handles OAuth
  2. A new browser tab opens and gets you to log in to your Adobe account
  3. The authorization code is "intercepted"
  4. The authorization code is used to get access_token (I believe a simple request.get() should be sufficient)

 

Has anyone done anything similar and got OAuth working nicely for the Adobe API 2 from a Jupyter notebook? In an ideal world I'd prefer the user not to have to manually open the URL to log on, then cut and paste the authorization code value into the Python code. Also can anyone confirm the latest authorization_uri, token_uri and redirect_uri's to use?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies