This sample demonstrates how to log in to ArcGIS Online or Enterprise using OAuth 2.0 authentication and the IdentityManager with @arcgis/core ES modules with Vite .
- Create a registered application in ArcGIS Online or ArcGIS Enterprise and add a valid redirect URL that will redirect you back to your hosted application after login. See the Register an OAuth application tutorial for more details.
- Copy the Client ID from your registered application in step 1 and use it to replace the
appId
property on line 27 in the main.js file. - Run
npm install
thennpm build dev
to test the app.
For a list of all available npm
commands see scripts
in package.json
.
For additional information, see:
- Implement user authentication in the ArcGIS Maps SDK for JavaScript documentation.
- Build with ES modules Guide topic in the SDK.
You can learn more in the Vite guides.