Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

GET fails, POST succeeds

New Here ,
Oct 09, 2013 Oct 09, 2013

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?

TOPICS
ActionScript
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2013 Oct 09, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 09, 2013 Oct 09, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 10, 2013 Oct 10, 2013

copy and paste a simplified get actionscript request that fails and a javascript request that suceeds.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 10, 2013 Oct 10, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 10, 2013 Oct 10, 2013
LATEST

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!"}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines