Hi John,

First you have to build token request within sequence and then call the
token APIs. Details about token APIs can be found in [1]. Let's say you
need to request a token with password grant type, then you have to build a
request as format specified in [2]. Below I have specified the
configuration you should write within a sequence. I haven't tested. But
format should be same. You may use call mediator instead send mediator.

  <property xmlns:ns="http://org.apache.synapse/xsd"; name="Authorization"
expression="fn:concat('Basic ','Base64 encoded
consumerKey:consumerSecret')" scope="transport" />
   <payloadFactory media-type="json">

<format>{"grant_type=password&username=<username>&password=<password>"}
  </format>
   </payloadFactory>
   <property name="messageType" value="application/x-www-form-urlencoded"
scope="axis2" />
   <send>
      <endpoint>
         <http method="post" uri-template="https://localhost:8243/token"; />
      </endpoint>
   </send>

[1] - https://docs.wso2.com/display/AM1100/Token+API
[2] -
https://docs.wso2.com/display/AM1100/Generating+Access+Tokens+with+User+Credentials+-+Password+Grant+Type

Please use dev mailing list for these type of conversations.

Thanks,
Harsha

On Fri, Jan 8, 2016 at 11:28 PM, John Q <[email protected]> wrote:

> Hello,
> Can any body tell me how can I get a an Api Manager Token from a sequence
> in the ESB?
>
> I know how to do it from a rest client but I don't know how to do the same
> thing from the esb using a payload mediator or whatever,
>
> thanks,
> johnq
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>


-- 
Harsha Kumara
Software Engineer, WSO2 Inc.
Mobile: +94775505618
Blog:harshcreationz.blogspot.com
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to