Hi Geesara, I'm talking about SAML2 grant type. I don't think the above doc explain how to construct a token object from the accessTokenResponse object returned when we exchange a SAML2 token with an OAuth token.
Thanks, Raj On Monday, 16 May 2016, Geesara Prathap <gees...@wso2.com> wrote: > Hi Rajkumar, > > Yes, The way an *oauth2Token* object is created is wrong. Please follow this > sample implementation <http://jaggeryjs.org/documentation.jag?api=oauth> > which explains how to construct an oauth2Token object. > > 1. http://jaggeryjs.org/documentation.jag?api=oauth > > Thanks, > Geesara > > On Sun, May 15, 2016 at 12:31 AM, Rajkumar Rajaratnam <rajkum...@wso2.com > <javascript:_e(%7B%7D,'cvml','rajkum...@wso2.com');>> wrote: > >> Hi, >> >> I am exchanging a SAML token with OAuth token using "getTokenResponse" >> method [1] of Jaggery's "OAuth" module. This method will return >> "AccessTokenResponse" >> object. But "sendOAuthRequest" method expects a "Token" object. Hence, I am >> manually creating "Token" object and passing it to "sendOAuthRequest" >> method, as shown below. I am referring [2] to create a "Token" object >> manually. >> >> >> >> >> >> >> * var accessTokenResponse = >> oauthProvider.getTokenResponse(samlResp); accessToken = >> accessTokenResponse.getAccessToken(); var oauth2Token = {}; >> oauth2Token.token = accessToken; oauth2Token.secret = >> "PkxikDuusEi67VpuqK7gpsLJlYIa"; var response = >> **oauthProvider.sendOAuthRequest(oauth2Token, >> "GET", "https://xx.xx.xx.xx:8251/bpmn/1.0.0/repository/deployments >> <https://xx.xx.xx.xx:8251/bpmn/1.0.0/repository/deployments>");* >> >> But I am getting the following exception when executing this block. I >> think this exception is thrown from here [3]. >> >> JavaException: org.jaggeryjs.scriptengine.exceptions.ScriptException: >> Invalid Access Token >> >> I think something is wrong with constructing the "Token" object. Any >> pointers? >> >> [1] >> https://github.com/wso2/jaggery-extensions/blob/master/oauth/resources/org.jaggeryjs.modules.oauth/src/main/java/org/jaggeryjs/modules/oauth/OAuthHostObject.java#L211-L238 >> [2] >> http://grepcode.com/file/repo1.maven.org/maven2/org.scribe/scribe/1.2.3/org/scribe/model/Token.java#Token.0token >> [3] >> https://github.com/wso2/jaggery-extensions/blob/master/oauth/resources/org.jaggeryjs.modules.oauth/src/main/java/org/jaggeryjs/modules/oauth/OAuthHostObject.java#L149 >> >> Thanks, >> Raj. >> >> -- >> Rajkumar Rajaratnam >> Committer & PMC Member, Apache Stratos >> Software Engineer, WSO2 >> >> Mobile : +94777568639 >> > > > > -- > Geesara Prathap Kulathunga > Software Engineer > WSO2 Inc; http://wso2.com > Mobile : +940772684174 > > -- Rajkumar Rajaratnam Committer & PMC Member, Apache Stratos Software Engineer, WSO2 Mobile : +94777568639
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev