Authentication in Browser-based Apps

In the Node.js guide we explained how to instantiate an ApplicationSession with hardcoded credentials. In the browser, you need to use OAuth 2.0 and have users sign directly into ArcGIS Online or ArcGIS Enterprise.

browser based login


// register your own app to create a unique clientId
const clientId = "abc123"

  redirectUri: ''

After the user has logged in, the session will keep track of individual trustedServers that are known to be federated and pass a token through when making requests.

request(url, { authentication: session })