0

I'm setting up a oauth-like flow, where making an actual request is postponed until some preliminary negotiation has completed.

The preliminary negotiation works, but when I try to make the request for the desired resource, I get the following behavior:

  • The django server logs a POST request for each step in the negotation.
  • The angular client logs an OPTIONS and a POST request for each step in the negotation.

So far so good.

Next, I get an OPTIONS request for the resource. This request gets stuck on pending in the browser, while $http's request function executes the error callback with a status of 0.

I get an error message from angular saying: failed to load resource.

This is the request object I'm passing to $http:

cache: false
data: null
headers: {
  Authorization: OAuth realm="all"oauth_consumer_key="21846675797"oauth_signature_method="PLAINTEXT"oauth_token="89676366323"oauth_timestamp="1376236699"oauth_nonce="dQBGqqTQf"oauth_signature="GET&localhost%3A16080%2Fkauth%2Ftest%2F&oauth_consumer_key%3D%2221846675797%22%26oauth_nonce%3D%22dQBGqqTQf%22%26oauth_signature_method%3D%22PLAINTEXT%22%26oauth_timestamp%3D%221376236699%22%26oauth_token%3D%2289676366323%22"
}
method: "GET"
params: null
url: "localhost:16080/kauth/test/"

I deleted all standard headers, out of fear they might interfere with my signature:

$http.defaults.headers.common = {};
$http.defaults.headers.get = {};
$http.defaults.headers.post = {};
$http.defaults.useXDomain = true;

The django server logs nothing for this request.

Any pointers would be appreciated.

lowerkey
  • 8,105
  • 17
  • 68
  • 102

1 Answers1

0

I found the answer...

Including the protocol (http://) at the beginning of the url does the trick.

lowerkey
  • 8,105
  • 17
  • 68
  • 102