Maximo

 View Only
Expand all | Collapse all

Connecting Maximo to OAUTH2 EndPoint

  • 1.  Connecting Maximo to OAUTH2 EndPoint

    Posted Sat December 26, 2020 11:05 PM
    Hello Experts,
    I have a requirement to connect Maximo with an HTTP endpoint that uses a token-based authorization method using OAUTH2. Although Maximo does not support OAUTH2 authorization yet, I developed an automation script that generates the API key (using client credentials, client secret) and updates the header in HTTP Endpoint. The solution was working very well until recently the HTTP endpoint is now configured in Google APIGEE. 
    After the change, my current script is unable to generate the API key. 
    I have recently found out that python-requests package (https://pypi.org/project/requests/) lets me generate the API key with new Endpoint. 
    Since this is an additional library not embedded in Maximo, I am looking for a solution to import this package in Maximo EAR and make it available for use in Automation Script.
    My question is how do I import python libraries in the Maximo server and enable it?
    I am using Maximo 7.6.1.1 with a Transportation add-on.

    Thanks
    Kushal Desai
    Technical Architect

    Python HTTP for Humans. Help the Python Software Foundation raise $60,000 USD by December 31st! Building the PSF Q4 Fundraiser
    pypi.org


    #AssetandFacilitiesManagement
    #Maximo


  • 2.  RE: Connecting Maximo to OAUTH2 EndPoint

    Posted Mon December 28, 2020 08:31 AM

    You can import it a couple of ways, but since you're on 7.6.1+ the preferred approach is to copy it to a location where every server can access it (or put it on every server) and then reference that path in the mxe.pylib.path system property which would make it available in every script that needs it. In earlier versions you could manually add it to the path but it required evaluating in each script whether it was already in the path or not and it was pretty hacky because of it. 

    That being said, anything but the most basic python packages doesn't typically work. This is because these have their own dependencies and it becomes a cascading problem (to import this package, you need package X, Y Z, which then need A,B,C). It'll probably be faster to address whatever issue you had managing the OAuth credentials than making this python package work inside of Maximo. 



    ------------------------------
    Steven Shull
    Director of Development
    Projetech Inc
    Cincinnati OH
    ------------------------------



  • 3.  RE: Connecting Maximo to OAUTH2 EndPoint

    Posted Tue October 04, 2022 03:13 AM
    Hello Kushal,
    Could you share the automation script that generate API key, please?

    ------------------------------
    Mahmoud AbdElhakiem
    ------------------------------



  • 4.  RE: Connecting Maximo to OAUTH2 EndPoint

    Posted Thu October 06, 2022 10:08 AM
    If you're able to get to 7.6.1.3 or are on MAS, just be aware that we added support for OAuth 2.0 to our endpoints out of the box. I wouldn't recommend writing your own method for generating refresh tokens once you get to these versions.

    ------------------------------
    Steven Shull
    ------------------------------



  • 5.  RE: Connecting Maximo to OAUTH2 EndPoint

    Posted Thu March 02, 2023 09:27 AM

    Hi Steven,

    We are in 7.6.1.3 and trying to integrate via OAuth 2.0. I have created the End Point and populated URL, username, password and HPPTEXIT. Should I populate OATHCLIENT? Also, should I create a new OATH Clients record via End Point --> Select action Add/Modify Clients?  

    My initial thought was to create an automation script for the Publish Channel for UserExit and somehow override the URL or Add Headers via the IntegrationContext.getCurrentContext() or via EndPointCache.getInstance().getEndPointInfo("ENDPOINTNAME").getProperty("URL").

    Thank you,

    Rajesh Vijayakumar 



    ------------------------------
    Rajesh Vijayakumar
    ------------------------------



  • 6.  RE: Connecting Maximo to OAUTH2 EndPoint

    Posted Thu March 02, 2023 09:38 AM

    Step #1 is to create the OAUTH client. You can use the Add/Modify Clients or send it via REST API (documented here: https://www.ibm.com/docs/en/maximo-manage/continuous-delivery?topic=handlers-configuring-oauth-access)

    Step #2 is to set the OAUTHCLIENT field property on the end point based on what you created above. Then the Maximo integration framework should manage it for you. You should not need to do anything special to override the headers at that point.



    ------------------------------
    Steven Shull
    ------------------------------



  • 7.  RE: Connecting Maximo to OAUTH2 EndPoint

    Posted Wed March 08, 2023 05:12 PM

    Can you please check the below Token URL? What would the redirect_uri for Maximo? I have provided a valid ClientID/Client Secret and grant type = "client_credentials"

    Token URL: https://xxxx.az.gov/portal/sharing/rest/oauth2/authorize?redirect_uri=http://maximo24:9080/maximo/ui&expiration=20160.

    Getting the below error when I Test the End Point... Seems to be missing.expiryinsec 

    java.lang.NullPointerException
        at psdi.iface.router.OAUTHClient.updateClient(OAUTHClient.java:158)
        at psdi.iface.router.OAUTHClient.getAccessToken(OAUTHClient.java:136)
        at psdi.iface.router.HTTPHandler.invoke(HTTPHandler.java:298)
        at psdi.iface.mic.MicService.routeData(MicService.java:284)
        at psdi.iface.app.endpoint.MaxEndPointTestSet.execute(MaxEndPointTestSet.java:161)
        at psdi.webclient.beans.endpoint.EndPointTestBean.testxml(EndPointTestBean.java:59)
        at sun.reflect.GeneratedMethodAccessor348.invoke(Unknown Source)



    ------------------------------
    Rajesh Vijayakumar
    ------------------------------



  • 8.  RE: Connecting Maximo to OAUTH2 EndPoint

    Posted Wed March 08, 2023 09:50 PM

    Turn the integration logger to debug and look at the logs. We output a lot of useful debug information such as the access token we retrieved, what value we have for the expires_in, etc. 

    I would then open a support case. Based on your version, you're correct that the line is where we try to set expiryinsec. If that's not coming from the OAuth response we need to handle that better to avoid the null pointer. 



    ------------------------------
    Steven Shull
    ------------------------------



  • 9.  RE: Connecting Maximo to OAUTH2 EndPoint

    Posted Wed June 07, 2023 09:00 AM
    Edited by David Miller Wed June 07, 2023 09:01 AM

    Steve,

    Is there any plans to add OAUTH support for Inbound integrations as well? I am at a client that needs to use OAUTH for a custom logon/user creation authentication functionality into Maximo.

    Thanks,

    Miller 



    ------------------------------
    David Miller
    Managing Partner - Maximo Consultant
    Enterprise Integration Partners LLC
    ------------------------------



  • 10.  RE: Connecting Maximo to OAUTH2 EndPoint

    Posted Wed June 07, 2023 09:30 AM

    I haven't heard of any plans and didn't find an idea for it on our ideas portal. If it's important to the customer I would have them open an idea https://ibm-ai-apps.ideas.ibm.com/ideas/. Most of the new capabilities we implement now are based on ideas and feedback we're hearing from customers. 



    ------------------------------
    Steven Shull
    ------------------------------