Hi all, I'm trying to pass a token to a secure FeatureLayer like this:
Then I Get :
I also using these methods to get the token:
So, How is the correct way to pass the token to secure layer?
Thanks
You shouldn't need to pass the token manually.
If you create the ServerInfo to reference the server of your service, use generateToken, and then registerToken with the IdentityManager, and the API will automatically pass the token to the service with each request.
Could someone please supply some sample code of what that process would look like please?
Hello Lee,
Have you got some sample code of what that process would look like? I need the same thing now....
Thanks,
Miri
This code sample is useful
https://codepen.io/benesri/pen/ExxwqMB
Hello @SafaaMamdouh ,
Thank you so much for your code. It is clear and easy to understand.
The thing is, that it asks the user for credentials (which I prefer not to) or if it is written hard coded in the code, it is very easy to find (you just open F12 and see it).
I'm looking for 2 options, depend on the identity store:
a. If it is a BUILT-IN identity store, I'm looking for a way to dedicate a user that will have the permissions to view the service and kind of a web service (in server side) that will get this user name and password and create a token based on this user & password, something like the proxy.ashx that was supported in the past. Now I understand that it is not recommended/supported anymore.
b. If it is WINDOWS identity store, I'm looking for a way to fetch the user name & password of the user and generate the token accordingly.
I hope I explained myself well....
Thanks again,
Miri