[Web API] Can't use AJAX on any API

I’m trying to make a Chrome extension that tells you if a user is following you or not, but when I request the URL

http://api.roblox.com/user/following-exists?userId=261&followerUserId=31323231

I get this in return

XMLHttpRequest cannot load http://api.roblox.com/user/following-exists?userId=261&followerUserId=31323231. Origin http://www.roblox.com is not allowed by Access-Control-Allow-Origin

This is the piece of jQuery I’m trying to use to get it:

$.ajax({ type: "GET", url: "https://api.roblox.com/user/following-exists", data: "userId=261&followerUserId=31323231", cache: false }).done(function(data){ console.log(data.isFollowing) })

I have also tried to access it using PHP and file_get_contents, but I get close to the same “access denied” error.

1 Like

This isn’t a bug. You need to add this to your extension’s manifest under permissions:

permissions: [ "http://api.roblox.com/*" ]

It looks likes you need to also be logged in on ROBLOX to hit this particular API, but from an extension this should pretty much always be the case.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.