Search code examples
oauth-2.0xpagesxpages-extlibibm-sbt

IBMSBT XPages custom endpoint Callback_uri vs redirect_uri


I'm trying to use the sbt in xpages with a custom endpoint i.e a new one defined in faces config using the class com.ibm.sbt.services.endpoints.OAuth2Endpoint

The authorisation url it generates is in the format of &client_id=xx&callback_uri=xxx

however the api i'm trying to use expects a parameter of redirect_uri

Looking at the spec for OAuth2 it appears that the convention is to use redirect_uri rather than callback_uri.

Is there a different end point class I can use which would use redirect_uri instead for the auth handler? NB: I've searched the source code and "OAUTH2_REDIRECT_URI" isn't used anywhere so I guess not, which makes me think I've misunderstood how to use it

Thanks!


Solution

  • I had a similar issue for our Basecamp demo application for IBM Connect 2014.

    I have inherited a new endpoint and handler for this purpose.

    In the handler class I had to rewrite getAuthorizationNetworkUrl() and getAccessTokenForAuthorizedUser() methods to change those url parameters.

    Overriding these methods might not be safe for the future of course. Instead, you might get the original URL and do some string operations to change desired parameters.

    @Override
    public String getAuthorizationNetworkUrl() {
      String newUrl=super();
      // Do string operations
      return newUrl;
    }
    

    Checking if anything changed for the new version of SBT would be needed. I hope it helps.