Embedded credential alternatives for HTTP requests

A while ago I created a chrome extension called MalOnTheGo. It works well, however chrome is now dropping support for a way to access resources from an API. The chromestatus for the blob can be found here . They drop support for a URL format called Embedded Credentials. I looked for alternatives but I couldn't find anything.

In the API documentation, they define the formatting of the link in the same way I use jQuery with username and password parameters like:

"Examples of using:

CURL:

curl -u user: passwordhttps: //myanimelist.net/api/account/verify_credentials.xml

This is one of the code snippets that chrome is warning me won't work at some point in June.

function verifyCredentials(username, password, error, success) {
                $.ajax({
                        "url": "https://myanimelist.net/api/account/verify_credentials.xml",
                        "error": error,
                        "username": encodeURIComponent(username),
                        "password": encodeURIComponent(password),
                        "success": success
                });
        }

      

The API documentation states that this is the way to access this resource. Is there anything I can change on my end, or is this the only way I can use it and the API developers need to update their implementation?

Any alternatives to what I have would help Thank you

+3


source to share


1 answer


You may find CORS to be useful for cross-domain request for credentials validation. There is a lot of useful information in this tutorial:

https://www.html5rocks.com/en/tutorials/cors/



You can still use ajax to fulfill your request, you just need to add some more headers for authentication. There is also a section specifically for Chrome extensions:

https://www.html5rocks.com/en/tutorials/cors/#toc-cross-domain-from-chrome-extensions

0


source







All Articles