Hi,I am not sure if you have tried the resources page on AGS JS Documentation. That explains in depth about OAuth 2.0 and its functionality in depth. There are different ways to set up security and OAuth is one of them. Here are couple links which will explain OAuth in detail.For Basic OAuth 2.0https://developers.arcgis.com/javascript/jshelp/ags_secureservices.html Further Details Regarding OAuth Authentication, User logins and App logins:https://developers.arcgis.com/authentication/user-logins.htmlSample which uses OAuth:https://developers.arcgis.com/javascript/jssamples/portal_oauth_inline.htmlAlso I will suggest keep your app Secret a SECRET. And do not give it to any one. If you give that information out it can be used anonymously and consume your credits for all the processes. So it is always better to provide User log ins when you provide any secured services.hope this will help you to some extent.Thanks,--Akshay HarsheTechnical Support AnalystESRI
Thanks,
Akshay Harshe