This sample contains pseudocode to quickly implement OAuth2 login to ArcGIS Enterprise or ArcGIS Online with the ArcGIS Maps SDK for JavaScript.
esride-nik/jaspi_oauth2_snippet
Short piece of code showing how to implement OAuth2 login from ArcGIS JS SDK to Portal and AGO.
TypeScript