2 Replies Latest reply on Apr 21, 2016 6:12 PM by rareddy

    Oauth 2.0 with microsoft graph fails with teiid-oauth-util

    davypriem

      Hi,

       

      I'm trying to setup a data connection to microsoft graph using oauth 2.0 with the teiid-oauth-util (teiid 8.12.4), but it errors with a string index out of range after entering the Access Token URL (https://login.microsoftonline.com/common/oauth2/v2.0/token). I've looked at the twitter and google examples and found out the authorization code in quite large when using microsoft oauth (in my case 651 chars, examples are on Authorization Code Grant Flow). Could this be a bug in the tool?

       

      Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind

      ex out of range: -1

              at java.lang.String.substring(String.java:1967)

              at org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider.readJSON

      Response(OAuthJSONProvider.java:173)

              at org.apache.cxf.rs.security.oauth2.client.OAuthClientUtils.getAccessTo

      ken(OAuthClientUtils.java:265)

              at org.apache.cxf.rs.security.oauth2.client.OAuthClientUtils.getAccessTo

      ken(OAuthClientUtils.java:208)

              at org.teiid.oauth.OAuthUtil.oauth20Flow(OAuthUtil.java:159)

              at org.teiid.oauth.OAuthUtil.main(OAuthUtil.java:79)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

      java:62)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

      sorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:497)

              at org.jboss.modules.Module.run(Module.java:312)

              at org.jboss.modules.Main.main(Main.java:473)