Hello Jacob
Two Thank you. one for your reply. and another one because this worked perfectly fine. but i am confused why the same old file works on the ArcGIS Online.
I had to do two more changes to ArcGIS Server Security Configuration in order to make it work.
C:\arcgisserver\config-store\security\security-config.json
"securityEnabled": false,
"sslEnabled": false,
Because every time i am asked for a token even if i made it last longer.
but anyways Thanks guys for your help.