OEG Best Practice: Anaplan Python OAuth Example

The Anaplan Python OAuth Example demonstrates using the Anaplan REST API with OAuth with device-based authorization. The code highlights how to generate adevice_id,access_token, andrefresh_token. Additionally, the code highlights a multi-threaded approach to request a newaccess_tokenwhile performing other, longer-running operations such as a large data load. Please note that with this code example, the concept is simulated by callingGet Workspacesfive times every 10 seconds while simultaneously refreshing theaccess_tokenevery 5 seconds. Please note that theaccess_tokenexpires after 35 minutes, so please adjust the timer to a value just below this expiration length (2100 seconds). Usage and the source code can be viewedhere.

Here is a brief overview of the example:

1)新的基于Oauth登记:

anaplan-oauth-token-refresh-new-device-registration.gif

2) After a successful registration, run unattended mode:

anaplan-oauth-token-refresh-device-registered.gif

3) To see all command line arguments, type: 'python3 anaplan.py -h'

anaplan-oauth-help.gif

4) To update any of the Anaplan API URLs, please edit the filesettings.json.

Note: Theclient_idandrefresh_tokenare stored as encrypted values in a SQLite database. As an alternative, a solution likeauth0would further enhance security.

Author: Quin Eddy,@QuinE- Director of Data Integration, Operational Excellence Group (OEG)

Comments

  • The Anaplan Python OAuth Example demonstrates using the Anaplan REST API with OAuth with device-based authorization.

  • The Anaplan Python OAuth Example demonstrates using the Anaplan REST API with OAuth with device-based authorization.