blackjyn / oauth-as3

Automatically exported from code.google.com/p/oauth-as3
0 stars 0 forks source link

2032 stream error on OAuth request #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an Adobe AIR project with this file:

package
{
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.net.URLLoader;
    import flash.net.URLRequest;

    import mx.utils.ObjectUtil;

    import org.iotashan.oauth.OAuthConsumer;
    import org.iotashan.oauth.OAuthRequest;
    import org.iotashan.oauth.OAuthSignatureMethod_HMAC_SHA1;

public class OAuthTest
    {
        protected var consumerKey:String = "LINKEDIN_APP_KEY";
        protected var consumerSecret:String = "LINKEDIN_APP_SECRET";
        protected var requestTokenUrl:String = "https://api.linkedin.com/uas/oauth/requestToken";       
        protected var consumer:OAuthConsumer = new OAuthConsumer(consumerKey, consumerSecret);
        protected var signatureMethod:OAuthSignatureMethod_HMAC_SHA1 = new OAuthSignatureMethod_HMAC_SHA1();

        public function OAuthTest()
        {
            var loader:URLLoader = new URLLoader();
            loader.addEventListener(Event.COMPLETE, requestTokenHandler);
            loader.addEventListener(IOErrorEvent.IO_ERROR, requestTokenError);
            var request:OAuthRequest = new OAuthRequest("GET", requestTokenUrl, null, consumer, null);
            loader.load(new URLRequest(request.buildRequest(signatureMethod)));
        }

        protected function requestTokenError(event:Event):void {
            trace("fail " + ObjectUtil.toString(event));
        }

        protected function requestTokenHandler(event:Event):void 
        {
            trace("pass " + ObjectUtil.toString(event));
        }
    }
}

2. Replace LINKEDIN_APP_KEY & SECRET with LinkedIn app details.
3. Run

What is the expected output? What do you see instead?

Expected output is "pass" followed by the event object, indicating a sucessful 
oauth token being received.

Actual output is a 2032 error: "Error #2032: Stream Error. URL: 
https://api.linkedin.com/uas/oauth/requestToken?oauth_consumer_key=XXXXX..."

What version of the product are you using? On what operating system?

Latest code retrieved from svn on Feb 5th 2011.

Please provide any additional information below.

Copying and pasting the url from the error into Safari or Firefox results in a 
successful authentication token being retrieved.

The code in this error report is based on the AIR and LinkedIn example from 
http://www.riagora.com/2011/01/air-and-linkedin/

This error occurs repeatedly when running the containing Flex project in debug 
mode.

Not tested with other OAuth request token urls.

Original issue reported on code.google.com by olliegla...@gmail.com on 6 Feb 2011 at 12:20

GoogleCodeExporter commented 9 years ago
Did you ever figure this out?  I am seeing the exact same issue when running 
the code in the android emulator BUT NOT in Flash Builder 4.6 (it works both in 
release and debug mode).  I adapted my code also from riagora.com...

I am reaching the point of desperation - any help would be very much 
appreciated...

Original comment by tolgaerdogus on 1 Jan 2012 at 7:26

GoogleCodeExporter commented 9 years ago
Has this indeed been fixed? Or would you care to provide examples if there is a 
way to get around that? That library would be nice if it worked.

Original comment by mathieu.jansonblanchet@gmail.com on 22 Feb 2012 at 9:21