﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Newsgator Forums / NewsGator API / Extras  / Suggestions needed to prevent login prompt from calling API by Flex / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>Newsgator Forums</description><link>http://forum.newsgator.com/</link><webMaster>info@newsgator.com</webMaster><lastBuildDate>Tue, 07 Oct 2008 20:51:58 GMT</lastBuildDate><ttl>20</ttl><item><title>Suggestions needed to prevent login prompt from calling API by Flex</title><link>http://forum.newsgator.com/Topic36667-8-1.aspx</link><description>we are interested in using NewsGator API for our News service. I am doing some prototypings right now to use our frontend Flex actionscript to call the corresponding REST API. I have difficulties to get around with the Authentication prompt by wrapping user credentials in actionscript code. I tried HTTPService and URLRequest. Tried encoding vs non-encoding. So far none is working yet. Below is a section of code, please give me some suggestions. &lt;BR&gt;&lt;BR&gt;Thanks &lt;BR&gt;---------------------- &lt;BR&gt;var request:URLRequest = new URLRequest(&lt;A class=moz-txt-link-rfc2396E href="https://services.newsgator.com/ngws/svc/Subscription.aspx/ALocation/headlines"&gt;https://services.newsgator.com/ngws/svc/Subscription.aspx/ALocation/headlines&lt;/A&gt;); &lt;BR&gt;request.method = URLRequestMethod.POST; &lt;BR&gt;var encoder:Base64Encoder = new Base64Encoder(); &lt;BR&gt;var str:String = "username:password"; &lt;BR&gt;var size:uint = str.length; &lt;BR&gt;encoder.encode(str, 0, size-1); &lt;BR&gt;var base64EncodedCredentials:String = encoder.flush(); &lt;BR&gt;var header1:URLRequestHeader = new URLRequestHeader("X-NGAPIToken", "YOURTOKEN"); &lt;BR&gt;var header2:URLRequestHeader = new URLRequestHeader("Authorization", "Basic " + base64EncodedCredentials); &lt;BR&gt;request.requestHeaders = [header1, header2]; &lt;BR&gt;var loader:URLLoader = new URLLoader(); &lt;BR&gt;&lt;BR&gt;//listen for when the data loads &lt;BR&gt;loader.addEventListener(Event.COMPLETE, showHeadlineOnCreateComplete); &lt;BR&gt;loader.load(request); &lt;BR&gt;</description><pubDate>Wed, 06 Feb 2008 14:16:06 GMT</pubDate><dc:creator>guolong.li</dc:creator></item></channel></rss>