<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://developer.myspace.com/Community/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>JavaScript/HTML - Container</title><link>http://developer.myspace.com/Community/forums/23.aspx</link><description>Discuss the OpenSocial container interface for MySpace.</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20910.1126)</generator><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/36112.aspx</link><pubDate>Fri, 13 Feb 2009 20:40:24 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:36112</guid><dc:creator>Tony</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/36112.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=36112</wfw:commentRss><description>F**ing Christmas!

Outstanding - I&amp;#39;ve pulled all my hair out but now its all worth it.</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/20109.aspx</link><pubDate>Tue, 09 Sep 2008 00:36:18 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:20109</guid><dc:creator>vDream Lijen</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/20109.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=20109</wfw:commentRss><description>I got this working in ruby too, if anyone is interested send me a message</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/20096.aspx</link><pubDate>Mon, 08 Sep 2008 21:18:38 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:20096</guid><dc:creator>vDream Lijen</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/20096.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=20096</wfw:commentRss><description>Just kidding, forgot to take into account clints last comment about the blank spaces.  Here&amp;#39;s whats working for me which incorporates his changes:

&lt;pre&gt;

$this_url = strtolower(&amp;#39;http://xxx/phpauth.php&amp;#39;);

$myspace_secret=&amp;quot;xxx&amp;quot;; //your myspace secret key

$opensocial_viewer_id=$_GET[opensocial_viewer_id];
$oauth_signature=$_GET[oauth_signature];

// check the sigs and make sure its  the real deal
$remote_signature = $_GET[&amp;#39;oauth_signature&amp;#39;];
unset($_GET[&amp;#39;oauth_signature&amp;#39;]);
ksort($_GET);
$url_me=urlencode($this_url);
$g_me=urlencode(http_build_query($_GET, null, &amp;#39;&amp;amp;&amp;#39;));
$g_me=str_replace( &amp;#39;%2B&amp;#39;, &amp;#39;%2520&amp;#39;, $g_me );
$base_string = &amp;quot;GET&amp;amp;$url_me&amp;amp;$g_me&amp;quot;;
$secret = &amp;quot;$myspace_secret&amp;amp;&amp;quot;;
$local_signature = base64_encode(hash_hmac(&amp;quot;sha1&amp;quot;, $base_string, $secret, TRUE));

&lt;/pre&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/20094.aspx</link><pubDate>Mon, 08 Sep 2008 21:04:43 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:20094</guid><dc:creator>vDream Lijen</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/20094.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=20094</wfw:commentRss><description>&lt;p&gt;Just wanted to give whoevers still reading this thread an update on my experiences.&amp;nbsp; I got the auth working with php.&amp;nbsp; I followed all the suggested posts in this thread, but I noticed one thing that was off.&amp;nbsp; The call to &lt;span class="methodname"&gt;&lt;b&gt;&lt;b&gt;http_build_query &lt;/b&gt;&lt;/b&gt;would return a query string that used &amp;amp;amp; as the arg seperator instead of &amp;amp; by default.&amp;nbsp; In short, it was url encoding the seperators in addition to the params.&amp;nbsp; You can call http_build_query with &lt;/span&gt;&lt;span class="methodparam"&gt;$arg_separator (the 3rd arg) to explicitly tell it to use &amp;amp;, and that worked for me!&amp;nbsp; The signatures now match.&amp;nbsp; Heres my complete code along with some helpful urls for me:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;pre&gt;$this_url = strtolower(&amp;#39;http://xxx/phpauth.php&amp;#39;);&lt;br /&gt;&lt;br /&gt;$myspace_secret=&amp;quot;xxx&amp;quot;; //your myspace secret key&lt;br /&gt;&lt;br /&gt;$opensocial_viewer_id=$_GET[opensocial_viewer_id];&lt;br /&gt;$oauth_signature=$_GET[oauth_signature];&lt;br /&gt;&lt;br /&gt;// check the sigs and make sure its  the real deal&lt;br /&gt;$remote_signature = $_GET[&amp;#39;oauth_signature&amp;#39;];&lt;br /&gt;unset($_GET[&amp;#39;oauth_signature&amp;#39;]);&lt;br /&gt;ksort($_GET);&lt;br /&gt;$url_me=urlencode($this_url);&lt;br /&gt;$g_me = urlencode(http_build_query($_GET, null, &amp;#39;&amp;amp;&amp;#39;));&lt;br /&gt;$base_string = &amp;quot;GET&amp;amp;$url_me&amp;amp;$g_me&amp;quot;;&lt;br /&gt;$secret = &amp;quot;$myspace_secret&amp;amp;&amp;quot;;&lt;br /&gt;$local_signature = base64_encode(hash_hmac(&amp;quot;sha1&amp;quot;, $base_string, $secret, TRUE));&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;

&lt;p&gt;http://meyerweb.com/eric/tools/dencoder/&lt;/p&gt;&lt;p&gt;http://us2.php.net/http_build_query &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hope that helps someone out there.&amp;nbsp; Now alls left to do is to get this thing working in ruby... &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/19440.aspx</link><pubDate>Wed, 03 Sep 2008 09:30:22 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:19440</guid><dc:creator>vDream Lijen</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/19440.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=19440</wfw:commentRss><description>&lt;p&gt;Im trying to reproduce the invite app found here (http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=112908) within this iframe, but am getting some errors.&amp;nbsp; Have you guys successfully been able to use opensocial within your frames?&amp;nbsp; From what I understand there are 2 nested frames here.&amp;nbsp; One default provided by MySpace, and the other one specifically inserted in the following code added to the top of the canvas surface:&lt;/p&gt;&lt;p&gt;&amp;lt;iframe id=&amp;quot;msiframe&amp;quot; name=&amp;quot;msiframe&amp;quot; src=&amp;quot;&amp;quot; height=&amp;quot;1000&amp;quot; width=&amp;quot;790&amp;quot; frameborder=&amp;quot;0&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;The inner frame doesn&amp;#39;t have the required opensocial js libraries included. When I try to manaully include them I get a lot of errors... &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/12735.aspx</link><pubDate>Wed, 25 Jun 2008 03:32:11 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:12735</guid><dc:creator>Clint</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/12735.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=12735</wfw:commentRss><description>&lt;p&gt;I figured out what my problem was.&amp;nbsp; If you use the external iFrame instead of the canvas with the makeRequest you get some additional parameters in the initial request.&amp;nbsp; The problem is that the opensocial_token MAY contain spaces.&amp;nbsp; After all of the processing mySpace is encoding these spaces as %2520 (ascii for space %20 encoded again).&amp;nbsp; However in the above code the space is getting encoded as %2B (turned into a + then encoded).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Replace the %2B with %2520 and you are golden.&amp;nbsp; phew.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Here is my final code.&lt;/p&gt;
&lt;p&gt;Good luck!&lt;/p&gt;
&lt;p&gt;Clint&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $remote_signature = $_GET[&amp;#39;oauth_signature&amp;#39;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //$url = strtolower( &amp;#39;http://clintokontendeuroswe.myspace.clinto.robinsonsplace.com/&amp;#39; );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $url = strtolower( $_SERVER[&amp;#39;SCRIPT_URI&amp;#39;] );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unset( $_GET[&amp;#39;oauth_signature&amp;#39;] );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ksort( $_GET );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $getString = urlencode( http_build_query( $_GET ) );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $getString = str_replace( &amp;#39;%2B&amp;#39;, &amp;#39;%2520&amp;#39;, $getString );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $base_string = &amp;#39;GET&amp;amp;&amp;#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlencode( $url ) . &amp;#39;&amp;amp;&amp;#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //urlencode( http_build_query( $_GET ) );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $getString;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $secret = &amp;#39;5f1ce2b5c4464bec9afe8e6c4de08c2d&amp;#39; . &amp;#39;&amp;amp;&amp;#39;;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $local_signature = base64_encode( hash_hmac( &amp;quot;sha1&amp;quot;, $base_string, $secret, TRUE ) );&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( $remote_signature == $local_signature ) {&lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/12712.aspx</link><pubDate>Tue, 24 Jun 2008 18:22:28 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:12712</guid><dc:creator>Clint</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/12712.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=12712</wfw:commentRss><description>&lt;p&gt;I am getting very inconsistent results with the authentication.&lt;/p&gt;
&lt;p&gt;It works &amp;#39;sometimes&amp;#39; from IE and never from Firefox (well not yet it is random).&amp;nbsp; I am using the modified code below.&amp;nbsp; I am always hitting the same page from an external iFrame.&amp;nbsp; I am dumping all the variables and cannot understand why&amp;nbsp;the signatures&amp;nbsp;matche sometimes and not others.&amp;nbsp;&amp;nbsp; The only changes in the $base_string&amp;nbsp;seem to be the expected changes in oauth_nonce, oauth_timestamp, and opensocial_token.&lt;/p&gt;
&lt;p&gt;Any ideas as to what stupid thing I am missing here?&lt;/p&gt;
&lt;p&gt;Thanks in advance,&lt;/p&gt;
&lt;p&gt;Clint&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $remote_signature = $_GET[&amp;#39;oauth_signature&amp;#39;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $url = strtolower( $_SERVER[&amp;#39;SCRIPT_URI&amp;#39;] ); //for debugging.&amp;nbsp; I have tried hard coded page value&amp;nbsp;also&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unset( $_GET[&amp;#39;oauth_signature&amp;#39;] );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ksort( $_GET );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $param_string = &amp;#39;&amp;#39;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $first = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach ($_GET as $key =&amp;gt; $value) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($first == 1) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $param_string .= &amp;#39;&amp;amp;&amp;#39;.$key.&amp;#39;=&amp;#39;.urlencode($value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $param_string .= $key.&amp;#39;=&amp;#39;.urlencode($value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $first = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $base_string = &amp;#39;GET&amp;amp;&amp;#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlencode( $url ) . &amp;#39;&amp;amp;&amp;#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //urlencode( http_build_query( $_GET ) );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlencode( $param_string );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $secret = $app-&amp;gt;getSecret() . &amp;#39;&amp;amp;&amp;#39;;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $local_signature = base64_encode( hash_hmac( &amp;quot;sha1&amp;quot;, $base_string, $secret, TRUE ) );&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( $remote_signature == $local_signature) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &amp;#39;success &amp;#39;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &amp;quot;url = $url secret = $secret remote = $remote_signature&amp;nbsp; local = $local_signature base_string = $base_string\n&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &amp;#39;not validated! &amp;#39;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &amp;quot;url = $url secret = $secret remote = $remote_signature&amp;nbsp; local = $local_signature base_string = $base_string\n&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/7918.aspx</link><pubDate>Thu, 17 Apr 2008 01:41:45 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7918</guid><dc:creator>crushspot.com</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7918.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7918</wfw:commentRss><description>&lt;p&gt;I have noticed situations in which MySpace&amp;#39;s URL encoding produces different results from PHP&amp;#39;s urlencode function. For example: the ~ is not consistently encoded between the two -- effectively making my code useless for people trying to use /~userdir directories.&lt;/p&gt;
&lt;p&gt;There are probably other differences that are causing problems for some, sadly I don&amp;#39;t have time to help anyone individually.&lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/7678.aspx</link><pubDate>Mon, 14 Apr 2008 20:57:11 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7678</guid><dc:creator>Minh</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7678.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7678</wfw:commentRss><description>&lt;p&gt;I just wanted to share my experience with getting authentication to work.&lt;/p&gt;&lt;p&gt;I used the code provided by crushspot but it didn&amp;#39;t work.&amp;nbsp; The remote signature was not matching with the local signature.&lt;/p&gt;&lt;p&gt;Looking at the base_string and comparing it with the one I tested on the myspace oauth tool, I realized that the &amp;#39;&amp;amp;&amp;#39; which is %26 was seen as 26%amp%3B on my side.&amp;nbsp; I also notice that the key values get double urlencoded, probably a mistake on myspace side.&amp;nbsp; Well in summary, seems like the code provided on the forum doesn&amp;#39;t work for everyone.&amp;nbsp; I think the problem might be related to the urlencode part.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Here&amp;#39;s the solution that works for me.&amp;nbsp; This works with canvas that uses IFRAME, which sends all the oauth info automatically when a user visits the canvas page.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;$remote_signature = $_GET[&amp;#39;oauth_signature&amp;#39;];&lt;br /&gt;$url = strtolower(&amp;#39;http://www.yoursite.com/authentication.php&amp;#39;);&lt;br /&gt;unset($_GET[&amp;#39;oauth_signature&amp;#39;]);&lt;br /&gt;&lt;br /&gt;ksort($_GET);&lt;br /&gt;&lt;br /&gt;$param_string = &amp;#39;&amp;#39;;&lt;br /&gt;$first = 0;&lt;br /&gt;foreach ($_GET as $key =&amp;gt; $value) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($first == 1) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $param_string .= &amp;#39;&amp;amp;&amp;#39;.$key.&amp;#39;=&amp;#39;.urlencode($value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $param_string .= $key.&amp;#39;=&amp;#39;.urlencode($value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $first = 1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$base_string = &amp;#39;GET&amp;amp;&amp;#39;.urlencode($url).&amp;#39;&amp;amp;&amp;#39;.urlencode($param_string);&lt;br /&gt;$secret = $yoursecretkey.&amp;#39;&amp;amp;&amp;#39;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$local_signature = base64_encode(hash_hmac(&amp;quot;sha1&amp;quot;, $base_string, $secret, true));&lt;br /&gt;&lt;br /&gt;if ($remote_signature == $local_signature)&lt;br /&gt;echo &amp;#39;success&amp;#39;;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/7575.aspx</link><pubDate>Sun, 13 Apr 2008 22:34:13 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7575</guid><dc:creator>Thomas Mango</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7575.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7575</wfw:commentRss><description>&lt;p&gt;I found my mistake. Everything is authenticating nicely using the external iframe url. &lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/7537.aspx</link><pubDate>Sun, 13 Apr 2008 01:27:06 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7537</guid><dc:creator>Thomas Mango</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7537.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7537</wfw:commentRss><description>&lt;p&gt;So it isn&amp;#39;t possible to just use the external url anymore and still authenticate it?&lt;/p&gt;&lt;p&gt;When you set the iframe to an external url, myspace attaches parameters to the query string. On my side, I was planning on using crushspot&amp;#39;s code to handle the request (using the external iframe url), create the signature on my side and compare it to oauth_signature passed in the query string. Unfortunately, I&amp;#39;m not having any luck making my local signature match the oauth_signature.&lt;/p&gt;&lt;p&gt;Additionally, with the approach of adding an iframe and making the request manually with javascript instead of just setting the external iframe url, you can&amp;#39;t point to your loopback (127.0.0.1) for testing, which is really annoying. &lt;/p&gt;&lt;p&gt;Anyway, I&amp;#39;d rather just point the external iframe url to my test application that&amp;#39;s running locally and still authenticate the request.&lt;/p&gt;&lt;p&gt;Any help would be greatly appreciated. Thanks, in advance  &lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/7529.aspx</link><pubDate>Sat, 12 Apr 2008 21:02:34 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7529</guid><dc:creator>Jeremy</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7529.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7529</wfw:commentRss><description>&lt;p&gt;Right off, PHP &amp;#39;echo&amp;#39; statements don&amp;#39;t seem to come back to the makeRequest return; I replaced them with &amp;#39;print&amp;#39; instead, and tried it out; it verified the signed makeRequest. I should note that during this test, I just dumped the &amp;#39;targetURL.text&amp;#39; field into the inner HTML of a div, but it come back authenticated.&lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/7526.aspx</link><pubDate>Sat, 12 Apr 2008 20:12:33 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7526</guid><dc:creator>Thomas Mango</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7526.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7526</wfw:commentRss><description>&lt;p&gt;Have you been able to get this code to work? I&amp;#39;m not having any luck either. Perhaps things have changed? Can anyone who has previously used this code chime in. Thanks, in advance &lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/7366.aspx</link><pubDate>Thu, 10 Apr 2008 22:07:24 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7366</guid><dc:creator>Behind Blue Eyes</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7366.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7366</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m still working on this. Does my base string look right that I&amp;#39;m hashing?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;GET&amp;amp;&lt;/p&gt;&lt;p&gt;http%3A%2F%2Fxxxxxxxx.xxxxxx.xx%2Fxxxxxxxxxxxxx%2Fauthenticate.php&lt;/p&gt;&lt;p&gt;&amp;amp;oauth_consumer_key%3Dhttp%253A%252F%252F&lt;/p&gt;&lt;p&gt;www.myspace.com%252F366757491%26amp%3B&lt;/p&gt;&lt;p&gt;oauth_nonce%3D633434618289426114%26amp%3B&lt;/p&gt;&lt;p&gt;oauth_signature_method%3DHMAC-SHA1%26amp%3B&lt;/p&gt;&lt;p&gt;oauth_timestamp%3D1207865028%26amp%3B&lt;/p&gt;&lt;p&gt;oauth_token%3D%26amp%3Boauth_version%3D1.0%26amp%3B&lt;/p&gt;&lt;p&gt;opensocial_owner_id%3D55331270%26amp%3Bopensocial_viewer_id%3D55331270&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;where the x&amp;#39;s represent the exact URL entered in the code I posted above...&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;edit: imagine those all as one line. they go off the page otherwise &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Pass User Id to Iframe app (what worked for me)</title><link>http://developer.myspace.com/Community/forums/thread/7107.aspx</link><pubDate>Tue, 08 Apr 2008 13:10:30 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7107</guid><dc:creator>Behind Blue Eyes</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7107.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7107</wfw:commentRss><description>&lt;p&gt;Hmm still can&amp;#39;t get it to work haha. I can&amp;#39;t find anything wrong either...&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&amp;lt;?php&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$remote_signature = $_GET[&amp;#39;oauth_signature&amp;#39;];&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$url = strtolower(&amp;#39;http://xxxxxxxx.xxxxxx.xx/xxxxxxxxxxxxx/authenticate.php&amp;#39;);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;unset($_GET[&amp;#39;oauth_signature&amp;#39;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ksort($_GET);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$base_string = &amp;#39;GET&amp;amp;&amp;#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; urlencode($url).&amp;#39;&amp;amp;&amp;#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; urlencode(http_build_query($_GET));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$secret = &amp;#39;80............................................d&amp;amp;&amp;#39;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$local_signature = base64_encode(hash_hmac(&amp;quot;sha1&amp;quot;, $base_string, $secret, TRUE));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ($remote_signature == $local_signature)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;session_start();&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$_SESSION[&amp;#39;authenticated&amp;#39;]=true;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;echo &amp;#39;http://xxxxxxxx.xxxxxx.xx/xxxxxxxxxxxxx/index.php&amp;#39;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;echo &amp;#39;http://xxxxxxxx.xxxxxx.xx/xxxxxxxxxxxxx/index.php&amp;#39;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;?&amp;gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;lt;iframe id=&amp;quot;msiframe&amp;quot; name=&amp;quot;msiframe&amp;quot; src=&amp;quot;&amp;quot; height=&amp;quot;1000&amp;quot; width=&amp;quot;790&amp;quot; frameborder=&amp;quot;0&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var serverURL=&amp;#39;http://xxxxxxxx.xxxxxx.xx/xxxxxxxxxxxxx/authenticate.php&amp;#39;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function init() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var params = {};&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gadgets.io.makeRequest(&amp;#39;http://xxxxxxxx.xxxxxx.xx/xxxxxxxxxxxxx/authenticate.php&amp;#39;, loadiframe, params);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function loadiframe(targetURL) { frames[&amp;#39;msiframe&amp;#39;].location.href = targetURL.text; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; init();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/script&amp;gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have checked and double checked for any typos or errors and can&amp;#39;t find anything wrong. Any ideas?&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>