Does it possible to use both jsonp and Bearer Authorization in an Ajax call ?

Does it possible to use both jsonp and Bearer Authorization in an Ajax call ?

Vincent GodéVincent Godé Posts: 12Questions: 2Answers: 0

Hello,

I face an strange things when I trying to send a request to a remote server protected by Bearer authorization : my bearer token is not include in in request :(.

This is the code :

    editorTranslations = new $.fn.dataTable.Editor({
            ajax: {
                create: {
                    type: "GET",
                    url:  "{{ urlCreate }}",
                    dataType: "jsonp",
                    headers: {
                        "Content-Type": "application/x-www-form-urlencoded",
                        "Authorization": "Bearer {{ bearerToken }}"
                    },
                },
                edit: {
                    type: "GET",
                    url:  "{{ urlUpdate }}",
                    dataType: "jsonp",
                    headers: {
                        "Content-Type": "application/x-www-form-urlencoded",
                        "Authorization": "Bearer {{ bearerToken }}"
                    },
                },
                remove: {
                    type: "GET",
                    url:  "{{ urlDelete }}",
                    dataType: "jsonp",
                    headers: {
                        "Content-Type": "application/x-www-form-urlencoded",
                        "Authorization": "Bearer {{ bearerToken }}"
                    },
                }
            },
            ...
    }

And this is the request sent :

As you can see, no bearer :(

But I remove the dataType: "jsonp", the bearer is well include :

So, just to know, is it possible to use both jsonp and bearer Authorization? Or jsonp means no bearer ?

Note : as explained here https://datatables.net/forums/discussion/comment/64693/#Comment_64693, I use GET for all my REST method because of jsonp.

Thanks

Replies

This discussion has been closed.