I want to create token for my feature layer from ArcGIS Online. Can anybody help me?
I know that I may use Identity Manager but never generate token before. Any ideas there are will be helpful!
You can do one of two things to get tokens, which you usually don't need to worry about too many details.
Just add the IdentityManager and you'll get a dialog to log in.
This authentication is only for the current session, refresh the browser and you are asked to log in again.
The recommended method is to use OAuth.
You can look at this sample.
Review the source code for this app by using "view source" or developer tools to check the source of this application.
The key here is to create an Application in ArcGIS Online, and get an appId/clientId.
Let me see if I can get the steps down for you here.
Click on "Add Item"
Go to the "Settings" tab for the item.
Click on "Update"
You'll see your "App ID" in there. I blurred it out, but it's really the client secret you do not want to share. If someone has your client secret, they can eat all your AGOL credits, so do not share it.
I also like to add "localhost" to the redirct URI. Then when you move this production, add the domain for the server your application will be running from.
Here is a link from that JSAPI sample to more docs on OAuth 2.0
ArcGIS Security and Authentication | ArcGIS for Developers
Hope that helps.
Thank you a lot! You even can't imagine how this advice helpful for me
Retrieving data ...