Olà Sergio,it did work, which somehow it really is a odd or strange behaviour, as i said in my first post, the code worked liked a charm until yesterday morning
Referer verification by portals is sometimes capricious but anyway using the right referer should help.the portal object should have (i guess) the CurrentUser set, a Token etc.... and instead those values are always null.
If i make a POST request to generateToken to require a token, and set the portal instance Token property with the returned value, CurrentUser property is always null.
Strange! That should work as soon as you set the Portal token.I just tried a WP program doing that. I get the right username:using System.Windows;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.Portal;
using Microsoft.Phone.Controls;
namespace PhoneApp1
{
public partial class MainPage : PhoneApplicationPage
{
public MainPage()
{
InitializeComponent();
IdentityManager.Current.TokenGenerationReferer = "file:///Applications/Install/";
IdentityManager.Current.GenerateCredentialAsync("http://www.arcgis.com/sharing/rest", "<username>", "<password>",
(crd, err) =>
{
if (crd != null)
{
var portal = new ArcGISPortal { Token = crd.Token };
portal.InitializeAsync(null, (p, e) => MessageBox.Show(p.CurrentUser.FullName));
}
else
MessageBox.Show("Error " + err.Message);
});
}
}
}