<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using IdentityManager to generate a short lived token in ArcGIS Runtime SDK for WPF (Retired) Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383969#M1898</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Should await --&amp;gt; async task, e.g.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var credential = await IdentityManager.Current.GenerateCredentialTaskAsync("url", "user1", "pass.word1");&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;work in silverlight? When I try I get the message: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"The await operator can only be used within an async method. Consider making this method with the 'async' modifier and changing its return type to 'Task'."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Dec 2013 20:49:37 GMT</pubDate>
    <dc:creator>QuinnKorbulic1</dc:creator>
    <dc:date>2013-12-16T20:49:37Z</dc:date>
    <item>
      <title>Using IdentityManager to generate a short lived token</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383967#M1896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;just thought I'd post a quick note about generating tokens with the IdentityManager.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The IdentityManager tries to determine the url to use for generating a token based on the url you supply and this works so long as you have /rest/services or /sharing in your url&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var credential = await IdentityManager.Current.GenerateCredentialTaskAsync(@"http://serverapps10.esri.com/arcgis/rest/services", "user1", "pass.word1");&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However if you just try creating one for the server url like &lt;/SPAN&gt;&lt;A href="http://serverapps10.esri.com/arcgis" rel="nofollow noopener noreferrer" target="_blank"&gt;http://serverapps10.esri.com/arcgis&lt;/A&gt;&lt;SPAN&gt; it will fail. You can get around this by registering the server first though&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var serverInfo = new ESRI.ArcGIS.Client.IdentityManager.ServerInfo { ServerUrl = @"http://serverapps10.esri.com/arcgis" };
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IdentityManager.Current.RegisterServers(new[] { serverInfo });
&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; var credential = await IdentityManager.Current.GenerateCredentialTaskAsync(@"http://serverapps10.esri.com/arcgis", "user1", "pass.word1");&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:40:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383967#M1896</guid>
      <dc:creator>DaveTimmins</dc:creator>
      <dc:date>2021-12-11T17:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using IdentityManager to generate a short lived token</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383968#M1897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Dave,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your are right. Thanks for sharing your tip.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;Note however that using such Url may be ambiguous because we might have a portal under "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://" rel="nofollow" target="_blank"&gt;http://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;domain&amp;gt;/arcgis/sharing" and a hosted ArcGIS server under "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://" rel="nofollow" target="_blank"&gt;http://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;domain&amp;gt;/arcgis/rest/services".&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Both servers don't share the same token generation workflow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I would recommend to keep your first version of code which works without any registration:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var credential = await IdentityManager.Current.GenerateCredentialTaskAsync(@"http://serverapps10.esri.com/arcgis/rest/services", "user1", "pass.word1");&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/Dominique&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 09:48:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383968#M1897</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2013-11-15T09:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using IdentityManager to generate a short lived token</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383969#M1898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Should await --&amp;gt; async task, e.g.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var credential = await IdentityManager.Current.GenerateCredentialTaskAsync("url", "user1", "pass.word1");&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;work in silverlight? When I try I get the message: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"The await operator can only be used within an async method. Consider making this method with the 'async' modifier and changing its return type to 'Task'."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Dec 2013 20:49:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383969#M1898</guid>
      <dc:creator>QuinnKorbulic1</dc:creator>
      <dc:date>2013-12-16T20:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using IdentityManager to generate a short lived token</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383970#M1899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In order to await the calling function must be declared as async.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Google on async/await.&amp;nbsp; This is not Silverlight specific behavior but rather the way that the language works.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Dec 2013 21:08:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383970#M1899</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2013-12-16T21:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using IdentityManager to generate a short lived token</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383971#M1900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Should await --&amp;gt; async task, e.g.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var credential = await IdentityManager.Current.GenerateCredentialTaskAsync("url", "user1", "pass.word1");&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;work in silverlight? When I try I get the message: &lt;BR /&gt;&lt;BR /&gt;"The await operator can only be used within an async method. Consider making this method with the 'async' modifier and changing its return type to 'Task'."&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.NET 4.5 provides better asynchronous programming&amp;nbsp; techniques using AsyncTask API operations to handle multiple requests asynchronously without blocking the UI. All AsyncTask are awaitable and hence require operations to be async with return type as Task instead of void. You could also use Task.Run to await a Task within any synchronous method if you would like. More about parallel/async programming can be found &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx"&gt;here&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Dec 2013 21:27:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383971#M1900</guid>
      <dc:creator>nakulmanocha</dc:creator>
      <dc:date>2013-12-16T21:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using IdentityManager to generate a short lived token</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383972#M1901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Should await --&amp;gt; async task, e.g.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var credential = await IdentityManager.Current.GenerateCredentialTaskAsync("url", "user1", "pass.word1");&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;work in silverlight? When I try I get the message: &lt;BR /&gt;&lt;BR /&gt;"The await operator can only be used within an async method. Consider making this method with the 'async' modifier and changing its return type to 'Task'."&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use async/await c# keywords in Silverlight but you need to load and reference the Async package &lt;/SPAN&gt;&lt;A href="http://www.nuget.org/packages/Microsoft.Bcl.Async/1.0.16"&gt;http://www.nuget.org/packages/Microsoft.Bcl.Async/1.0.16&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that for simplicity&amp;nbsp; I used 'await' in my sample but you could as well used the event based method GenerateCredentialAsync.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Dec 2013 21:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/using-identitymanager-to-generate-a-short-lived/m-p/383972#M1901</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2013-12-16T21:44:51Z</dc:date>
    </item>
  </channel>
</rss>

