Hi Ragu,

At the time of calling the API do you know the consumer key and consumer
secret? If these are known, then you can use the /token API for getting the
access token. If these are not known, then you can generate them once per
application through the jag endpoint and use it for consequent API calls of
the application.

Thanks,
NuwanD.


On Mon, May 20, 2013 at 7:48 AM, Supun Malinga <sup...@wso2.com> wrote:

> Hi Ragu,
>
> Could you tell the requirement you are trying to achieve here?.
>
> The key generation from the store should be a one time thing AFAIU. After
> that you have /token API to generate access tokens and renew those tokens
> upon expiery.
> Generally what users do is access the store from UI and generate the keys,
> then they do a REST call(to /token) and get the access token.
>
> thanks,
>
>
> On Mon, May 20, 2013 at 6:49 AM, Sriragu Arudsothy <srir...@wso2.com>wrote:
>
>> hai All, Sumedha,
>>
>>                            What am I doing is that I am calling the
>> access token generation  REST endpoint from Greg. Here the API manager is
>> running as an another instance, When a user clicks a menu item from Greg
>> management console, it will call the Token generation REST endpoint and
>> generate the key and displayed at the Greg.
>>
>>
>> I am unclear whether am I calling the right endpoint or not?
>>
>> I am running the API manager with default configuration.
>>
>> Thanks!
>> Ragu
>>
>>
>>
>>
>> On Mon, May 20, 2013 at 1:09 AM, Dinusha Senanayaka <dinu...@wso2.com>wrote:
>>
>>>
>>>
>>> On Mon, May 20, 2013 at 12:47 AM, Sriragu Arudsothy <srir...@wso2.com>wrote:
>>>
>>>> Hai all,
>>>>
>>>>           I have used the following REST call to generate the access
>>>> token from API manager.
>>>>
>>>>
>>>> http://127.0.0.1:9763/store/site/blocks/subscription/subscription-add/ajax/subscription-add.jag?action=generateApplicationKey&keytype=Bearer&callbackUrl=&authorizedDomains=All&application=Registry
>>>>
>>>> The response contains the consumer key/ secret and access token ..etc.
>>>> When I used the generated access token to access the registry resources
>>>> using Registry REST API it  shows the following error at the back end.
>>>>
>>>> org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException:
>>>> Error while accessing backend services for API key validation
>>>> at
>>>> org.wso2.carbon.apimgt.gateway.handlers.security.thrift.ThriftAPIDataStore.getAPIKeyData(ThriftAPIDataStore.java:79)
>>>>  at
>>>> org.wso2.carbon.apimgt.gateway.handlers.security.APIKeyValidator.doGetKeyValidationInfo(APIKeyValidator.java:126)
>>>> at
>>>> org.wso2.carbon.apimgt.gateway.handlers.security.APIKeyValidator.getKeyValidationInfo(APIKeyValidator.java:110)
>>>>  at
>>>> org.wso2.carbon.apimgt.gateway.handlers.security.oauth.OAuthAuthenticator.authenticate(OAuthAuthenticator.java:116)
>>>> at
>>>> org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler.handleRequest(APIAuthenticationHandler.java:88)
>>>>  at org.apache.synapse.rest.API.process(API.java:252)
>>>> at
>>>> org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
>>>>  at
>>>> org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:63)
>>>> at
>>>> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:191)
>>>>  at
>>>> org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)
>>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>>>  at
>>>> org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:353)
>>>> at
>>>> org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:196)
>>>>  at
>>>> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
>>>> at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>  at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>> at java.lang.Thread.run(Thread.java:662)
>>>>
>>>>
>>>> Caused by:
>>>> org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException:
>>>> Unauthorized client domain :null. Only "All" domains are authorized to
>>>> access the API.
>>>>  at
>>>> org.wso2.carbon.apimgt.gateway.handlers.security.thrift.ThriftKeyValidatorClient.getAPIKeyData(ThriftKeyValidatorClient.java:87)
>>>> at
>>>> org.wso2.carbon.apimgt.gateway.handlers.security.thrift.ThriftAPIDataStore.getAPIKeyData(ThriftAPIDataStore.java:77)
>>>>  ... 16 more
>>>>
>>>> but I have specified the authorizedDomain during the call request.
>>>>
>>> How did you define the authorized domain in your request ? If you use
>>>> the default configuration in apimanager.xml, domain should pass along with
>>>> http header 'referer' (eg: -H "referer: wso2.com") .
>>>>
>>>
>>> Regards,
>>> Dinusha.
>>>
>>>
>>>>
>>>>
>>> Please API team give me a response as soon as possible.
>>>>
>>>> Thanks!
>>>> Ragu
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Dinusha Dilrukshi
>>> Software Engineer
>>> WSO2 Inc.: http://wso2.com/
>>> Mobile: +94725255071
>>> Blog: http://dinushasblog.blogspot.com/
>>>
>>
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Supun Malinga,
>
> Software Engineer,
> WSO2 Inc.
> http://wso2.com
> http://wso2.org
> email - sup...@wso2.com <sup...@wso2.com>
> mobile - 071 56 91 321
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Nuwan Dias

Member, Management Committee - Solutions Technology Group
Software Engineer - WSO2, Inc. http://wso2.com
email : nuw...@wso2.com
Phone : +94 777 775 729
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to