<?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: Problem with getting token for authentication in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298000#M2657</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just out of curiosity, could you use the AGSCredential class instead of manually asking for the token?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;AGSCredential *myCredential = [[AGSCredential alloc] initWithUser:[jsonDict objectForKey:@"username"] password:[jsonDict objectForKey:@"password"]&amp;nbsp; authenticationType:AGSAuthenticationTypeToken tokenUrl:url];&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can access the token provided here using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;myCredential.token;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe all the AGS classes that are used to access services that may or may not be secured have a "credential:" optional argument.&amp;nbsp; So in this case if you wanted to get information about a secured map service you'd do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;NSError *serviceError = nil;
AGSMapServiceInfo *serviceInfo = [[AGSMapServiceInfo alloc] initWithURL:mapServiceEndpoint credential:myCredential error:&amp;amp;serviceError];&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know this wasn't exactly what you were asking, but hope it helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 14:18:20 GMT</pubDate>
    <dc:creator>ChrisRiver</dc:creator>
    <dc:date>2021-12-11T14:18:20Z</dc:date>
    <item>
      <title>Problem with getting token for authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/297999#M2656</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;I'm trying to access a secured service that requires a token. When I input the getToken url into a browser, I could get the token JSON response without any problem. However, when I try to execute it within my code as follows: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSURL *url = [NSURL URLWithString:@"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://.../getToken" rel="nofollow" target="_blank"&gt;http://.../getToken&lt;/A&gt;&lt;SPAN&gt;"];&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSString *json = @"{\"accessKEY\":\"i...\"}";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSDictionary *jsonDict = [json AGSJSONValue];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSJSONRequestOperation *jsonOp = [[[AGSJSONRequestOperation alloc] initWithURL:url queryParameters:jsonDict] autorelease];&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Output:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{"GetToken":[{"Invalid Access":"IP Address"}]}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any idea as to what may be the cause of the above problem? Any workaround?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rgds&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ong CF&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2012 03:04:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/297999#M2656</guid>
      <dc:creator>c_f_ong</dc:creator>
      <dc:date>2012-10-03T03:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with getting token for authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298000#M2657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just out of curiosity, could you use the AGSCredential class instead of manually asking for the token?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;AGSCredential *myCredential = [[AGSCredential alloc] initWithUser:[jsonDict objectForKey:@"username"] password:[jsonDict objectForKey:@"password"]&amp;nbsp; authenticationType:AGSAuthenticationTypeToken tokenUrl:url];&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can access the token provided here using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;myCredential.token;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe all the AGS classes that are used to access services that may or may not be secured have a "credential:" optional argument.&amp;nbsp; So in this case if you wanted to get information about a secured map service you'd do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;NSError *serviceError = nil;
AGSMapServiceInfo *serviceInfo = [[AGSMapServiceInfo alloc] initWithURL:mapServiceEndpoint credential:myCredential error:&amp;amp;serviceError];&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know this wasn't exactly what you were asking, but hope it helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:18:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298000#M2657</guid>
      <dc:creator>ChrisRiver</dc:creator>
      <dc:date>2021-12-11T14:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with getting token for authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298001#M2658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Please go through &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/runtime-ios-sdk/concepts/index.html#/Secure_Services/00pw0000002m000000/"&gt;secured services&lt;/A&gt;&lt;SPAN&gt; document and let me know if you have any specific question.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2012 14:58:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298001#M2658</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2012-10-03T14:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with getting token for authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298002#M2659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Please go through &lt;A href="http://resources.arcgis.com/en/help/runtime-ios-sdk/concepts/index.html#/Secure_Services/00pw0000002m000000/"&gt;secured services&lt;/A&gt; document and let me know if you have any specific question.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Nimesh&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to validate the generated token externally (like valid or not valid)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Jan 2013 07:51:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298002#M2659</guid>
      <dc:creator>AshishArora</dc:creator>
      <dc:date>2013-01-27T07:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with getting token for authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298003#M2660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No, it is server's responsibility. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2013 15:38:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298003#M2660</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2013-01-28T15:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with getting token for authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298004#M2661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;No, it is server's responsibility. &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Nimesh&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2013 17:09:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/problem-with-getting-token-for-authentication/m-p/298004#M2661</guid>
      <dc:creator>AshishArora</dc:creator>
      <dc:date>2013-01-28T17:09:18Z</dc:date>
    </item>
  </channel>
</rss>

