ExtJS4, Ajax request on OPS ? Problem with cross-origin...

This space is made available to users of Open Patent Services (OPS) web-service and now also to users of EPO’s bulk data subscription products such as 14. EPO worldwide bibliographic database (DOCDB), 14.11 EPO worldwide legal status database (INPADOC), 14.12 EP full text data, 14.1 EP bibliographic data (EBD)and more.

Users can ask each other questions, exchange experiences and solutions, post ideas. The moderator will use this space to announce changes or other relevant information.
Post Reply

Bruno
Posts: 171
Joined: Thu Jan 29, 2004 10:14 pm
Location: France
Contact:

ExtJS4, Ajax request on OPS ? Problem with cross-origin...

Post by Bruno » Tue Oct 14, 2014 10:58 pm

Dear OPS Support,

I'm trying to get my Token by using on my server an ExtJS4 ajax request (sencha framework).

My code is below but I get always this error on FireFox.
I understand the problem, but I don't know how can I solve it... :cry:
"NetworkError: 401 Unauthorized - https://ops.epo.org/3.1/auth/accesstoken"


Une demande multi-origines (Cross-Origin Request) a été bloquée : la politique « Same Origin » ne permet pas de consulter la ressource distante située sur https://ops.epo.org/3.1/auth/accesstoken. Ceci peut être corrigé en déplaçant la ressource sur le même domaine ou en activant CORS.
I use this code:

Code: Select all

        Ext.Ajax.useDefaultXhrHeader = false;
        Ext.Ajax.cors = true;
        
        Ext.Ajax.request({
            scope   : this,
            url     : 'https://ops.epo.org/3.1/auth/accesstoken',
            method  : 'POST',
            //type    :'jsonp',
            cors    : true,
                        
            headers: {
                'Access-Control-Allow-Origin': '*',
                Authorization   : 'Basic QXQ1TEJ6bUta....vNUNYYWQ4NzJOenY2NA=='
            },
            params: {
                grant_type      : 'client_credentials'
            },
            success: function(response) {

                // convert text response to javascript object
                var res = Ext.JSON.decode(response.responseText);
                alert(response.responseText);
                // if server response contains "success" node, then success!        
                if (res.success === true) 
                {   
                }

            }
        });
Is someone here (or the support) has already done that with ExtJS4 Sencha ?

Many thanks for your help,

regards,

Bruno M.




Post Reply