Skip to main content
New Participant
October 9, 2013
Question

GET fails, POST succeeds

  • October 9, 2013
  • 1 reply
  • 1752 views

I have a .swf made from an AIR project that makes https request to a REST api (i.e. Parse.com)

There is no problem running this .swf with AIR.

If I were to run this .swf in regular Flash player 11, I encounter:

GET request I receive error 401 (unauthorized)

POST request there is no problem.

Is this expected?

This topic has been closed for replies.

1 reply

kglad
Community Expert
October 9, 2013

not because of anything on the flash side.  if you had a flash problem it would be a security sandbox error and would occur with post and get.

check that rest api to see if it allows get requests.

bo_huangAuthor
New Participant
October 9, 2013

I should clarify that GET is allowed, because if I run the exact same .swf with the ADL instead of Flash player 11, both GET and POST requests succeed.

In addition to Parse.com, I also tried Stackmob.com's REST api. Similar results:

http://support.stackmob.com/entries/27724236-Invalid-OAuth-credentials-or-signature-Key-not-provided

But works fine if launched in ADL.

I'm here because these REST api companies do not support as3 and can't help.

bo_huangAuthor
New Participant
October 11, 2013

How do you perform authentication? Without seeing your code this is a guess in the dark, but one of the limitations with GET in the browser plugin is that it cannot send basic auth headers. Only POST can. In AIR you aren't subject to this limitation.

-Aaron


I uploaded a FlashDevelop AIR project.

http://temp-share.com/show/3Yg8b3Qnx/a956b800e1d5ac09a2b7a92d6ffbdc95

Main class is StackMobTest.as, (managed by application.xml)

it depends on the included

com.cycleit.stackmobconn package

and

as3crypto.swc for user authentication (though not used in this example)

The built .swf in

/bin/stackmob.swf

does a GET on an entirely public access schema named 'blogentry' and prints to console:

If launching with FlashPlayer 11:

[Starting debug session with FDB]

{"error":"Invalid OAuth credentials or signature: Key not provided"}

If launching with ADL:

[Starting debug session with FDB]

[{"lastmoddate":1381449318701,"createddate":1381449318701,"text":"test string","blogentry_id":"blogentry1"},{"lastmoddate":1381449332754,"createddate":1381449332754,"text":"test string","blogentry_id":"blogentry2"}]

{"createddate":1381449344126,"lastmoddate":1381449344126,"blogentry_id":"e94f6d54d7fb43a49c80e68f2ae436f4","message":"SM AS3 SDK 0.0.1 Test"}

{"createddate":1381449344126,"lastmoddate":1381449344126,"blogentry_id":"e94f6d54d7fb43a49c80e68f2ae436f4","message":"SM AS3 SDK 0.0.1 Test"}

{"createddate":1381449344126,"lastmoddate":1381449344715,"blogentry_id":"e94f6d54d7fb43a49c80e68f2ae436f4","message":"Updated Message for AS3 SDK!"}