Developer

 View Only
  • 1.  pyCentral token management

    Posted Nov 01, 2024 01:37 PM
    Edited by mroe1234 Nov 01, 2024 02:06 PM

    I'm having trouble using pyCentral and managing/refreshing tokens to my central on prem instance.  I am not using OAUTH, but just token access.  I assumed this code would work as expected, storing the most recent token and refresh token in the default token_store (/temp/tok_None_*****).  My central_info looks like:

    central_info = {
        "base_url": "https://apigw-cop.*********",
        "client_secret": "3jorSOIozX**************",
        "client_id": "KxOg******************************",
        }
    def connect_to_central():
      ssl_verify = True
      central = ArubaCentralBase(central_info=central_info,
      ssl_verify=ssl_verify)
      central.refreshToken(central.getToken())
      central.storeToken()
      return central

    However, refreshToken seems to return the new token but not actually update the connection object?  So I have to do something like:

    def connect_to_central():
        ssl_verify = True
        central = ArubaCentralBase(central_info=central_info,
                               ssl_verify=ssl_verify)
        newToken = central.refreshToken(central.getToken())
        newToken['grant_type'] = "refresh_token"
        central.storeToken(newToken)
        central.loadToken()
        return central

    Which also doesn't seem to work correctly.  At this point I am starting to believe that I am misunderstanding something fundamental and should stop poking and ask for some advice.  Ultimately, I am trying to write a script that periodically pulls data from Central On Prem, and "handles" token management.



  • 2.  RE: pyCentral token management

    Posted 25 days ago

    Hi,

    Do you have ask on github pycentral repo ?



    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------