<?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: How to implement App Login? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-implement-app-login/m-p/637287#M59546</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The end user doesn't need to go through any login screen. Login has to happen in background with one enterprise licence. But we figured it out. So here is code below if anyone has the same question.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;authenticateAPI: function () {
	var me = this;
	return new Promise(function (resolve, reject) {
		try {
			require(["esri/request", "esri/identity/IdentityManager"], function (esriRequest, identityManager) {
				var serverAdr = 'https://www.arcgis.com/sharing/rest';
				var requestURL = serverAdr + '/oauth2/token?client_id=' + me.client_id + '&amp;amp;client_secret=' + me.client_secret + '&amp;amp;grant_type=client_credentials';				
				esriRequest(requestURL, {
					responseType: "json"
				}).then(function (responce) {
					identityManager.registerToken({
						token: responce.data.access_token,
						expires: responce.data.expires_in,
						server: serverAdr
					});
					identityManager.checkSignInStatus('https://www.arcgis.com/sharing').then(function () {						
						return resolve();
					}).catch(function (error) {						
						return reject();
					});
				}).catch(function (error) {					
					return reject();
				});
			});
		} catch (exception) {			
			return reject();
		}
	});
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 03:04:59 GMT</pubDate>
    <dc:creator>Rupam_RanjanRana</dc:creator>
    <dc:date>2021-12-12T03:04:59Z</dc:date>
    <item>
      <title>How to implement App Login?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-implement-app-login/m-p/637285#M59544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We have a hybrid mobile app, UI running on web view. We're migrating the app from google maps for JS to ArcGis 4.10 for JS. Google maps signs in with a developer token. Is there an equivalent in ArcGis? Named user login is not viable for us. We want all the user be using a corporate licence. We have created a developer account and registered the app as a web application, and we got the &lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;Client ID,&amp;nbsp;Client Secret,&amp;nbsp;&lt;/SPAN&gt;&lt;LABEL class="" for="tokenInput" style="background-color: #ffffff; margin: 0px 0px 0rem;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;Temporary Token. But we have no clue what to do with them.&amp;nbsp;We have a server setup, that can get us any access token or user id before initialising&amp;nbsp;the &lt;SPAN style="color: #3d3d3d;"&gt;ArcGis API. Any sample code for the same will be helpful.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LABEL&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2019 03:42:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-implement-app-login/m-p/637285#M59544</guid>
      <dc:creator>Rupam_RanjanRana</dc:creator>
      <dc:date>2019-03-13T03:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement App Login?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-implement-app-login/m-p/637286#M59545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rupam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; So do you want the end user presented with a login screen or not?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2019 12:58:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-implement-app-login/m-p/637286#M59545</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-03-13T12:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement App Login?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-implement-app-login/m-p/637287#M59546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The end user doesn't need to go through any login screen. Login has to happen in background with one enterprise licence. But we figured it out. So here is code below if anyone has the same question.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;authenticateAPI: function () {
	var me = this;
	return new Promise(function (resolve, reject) {
		try {
			require(["esri/request", "esri/identity/IdentityManager"], function (esriRequest, identityManager) {
				var serverAdr = 'https://www.arcgis.com/sharing/rest';
				var requestURL = serverAdr + '/oauth2/token?client_id=' + me.client_id + '&amp;amp;client_secret=' + me.client_secret + '&amp;amp;grant_type=client_credentials';				
				esriRequest(requestURL, {
					responseType: "json"
				}).then(function (responce) {
					identityManager.registerToken({
						token: responce.data.access_token,
						expires: responce.data.expires_in,
						server: serverAdr
					});
					identityManager.checkSignInStatus('https://www.arcgis.com/sharing').then(function () {						
						return resolve();
					}).catch(function (error) {						
						return reject();
					});
				}).catch(function (error) {					
					return reject();
				});
			});
		} catch (exception) {			
			return reject();
		}
	});
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:04:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-implement-app-login/m-p/637287#M59546</guid>
      <dc:creator>Rupam_RanjanRana</dc:creator>
      <dc:date>2021-12-12T03:04:59Z</dc:date>
    </item>
  </channel>
</rss>

