Some samples require you to configure your own portal for authentication. This page describes the OAuth pattern.
Login to your ArcGIS Developers site account and register an app.
For an app registered and hosted on ArcGIS.com, use https://www.arcgis.com/
as the portal URL.
Once registered, select the Authentication tab to get your Client ID.
In the Authentication tab, go to the Redirect URIs section and add urn:ietf:wg:oauth:2.0:oob
.