No.    Its not working yet.

I added  CORS Handler in tokenapi.xml and revokeapi.xml

restarted  server

tested  my application.

Now I am getting a CORS wildcard error  in my application.   Please see the
application error screenhsot and wso2 cors handler screenshot.

Regards
Shib



On Thu, Jun 14, 2018 at 3:55 PM, Bhathiya Jayasekara <[email protected]>
wrote:

> This should work for you.
>
> https://medium.com/@iloshinikarunarathne/enabling-
> cors-for-token-apis-in-wso2-apim-d04f7ef5171
>
> Thanks,
> Bhathiya
>
> On Thu, Jun 14, 2018 at 3:33 PM shibsankar <[email protected]> wrote:
>
>> *grant_type=password.*
>>
>>
>>
>> For your convenience, I  am providing the Angular JS relevant code
>>
>>
>> *// from Angular Controller js*
>>
>> var dataObj="grant_type=password&username=xxxxxxxxx&password=
>> xxxxxxxxx&scope=openid";
>>
>>                          Service.callTokenAPI(dataObj)
>> .then(function onSuccess(response) {
>> console.log("Success");
>> console.log("result #### = " + JSON.stringify(response));
>> }, function onFailure(error) {
>> console.log("failure");
>> });
>>
>>
>>
>> *//from Service.js*
>>
>> var callTokenAPI = function (dataObj) {
>> console.log("Call server dataObj =" + angular.toJson(dataObj));
>> var secret=clientKey+":"+clientPass;
>> var base64Encoded= btoa(secret);
>> console.log("base64Encoded="+base64Encoded);
>> return $http({
>> url: tokenAPI,
>> method: 'POST',
>> data: dataObj,
>> headers: { "Content-Type": "application/json;charset=utf-8"
>> ,"Authorization":base64Encoded}
>> });
>> };
>>
>>
>> When I  run this I am getting CORS error screenshot shared earlier.
>>
>> Regards
>> Shib
>>
>>
>> On Thu, Jun 14, 2018 at 3:00 PM, Rushmin Fernando <[email protected]>
>> wrote:
>>
>>> Could you please let us know the grant type you are using here. I would
>>> like to know whether this is a valid use case.
>>>
>>> On Thu, Jun 14, 2018 at 2:54 PM shibsankar <[email protected]> wrote:
>>>
>>>> Yes.  I get  same CORS error with the correct endpoint, which is */*
>>>> *token*
>>>>
>>>> screenshot attached.
>>>>
>>>> Regards
>>>> Shib
>>>>
>>>> On Thu, Jun 14, 2018 at 2:42 PM, Rushmin Fernando <[email protected]>
>>>> wrote:
>>>>
>>>>> In the console logs, it says */toekn, *which is wrong spellings.
>>>>>
>>>>> Do you get the same CORS error with the correct endpoint, which is 
>>>>> */**token
>>>>> *?
>>>>>
>>>>> On Thu, Jun 14, 2018 at 2:26 PM shibsankar <[email protected]> wrote:
>>>>>
>>>>>> I am receiving CORS Error when I call the WSO2 token API  from
>>>>>> Angular JS application.
>>>>>>
>>>>>> How do you fix this?
>>>>>>
>>>>>> Regards
>>>>>> Shib(9831418066)
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> [email protected]
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Best Regards*
>>>>>
>>>>> *Rushmin Fernando*
>>>>> *Technical Lead*
>>>>>
>>>>> WSO2 Inc. <http://wso2.com/> - Lean . Enterprise . Middleware
>>>>>
>>>>> mobile : +94775615183
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> *Best Regards*
>>>
>>> *Rushmin Fernando*
>>> *Technical Lead*
>>>
>>> WSO2 Inc. <http://wso2.com/> - Lean . Enterprise . Middleware
>>>
>>> mobile : +94775615183
>>>
>>>
>>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>
>
> --
> *Bhathiya Jayasekara*
> *Associate Technical Lead,*
> *WSO2 inc., http://wso2.com <http://wso2.com>*
>
> *Phone: +94715478185*
> *LinkedIn: http://www.linkedin.com/in/bhathiyaj
> <http://www.linkedin.com/in/bhathiyaj>*
> *Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>*
> *Blog: http://movingaheadblog.blogspot.com
> <http://movingaheadblog.blogspot.com/>*
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to