When you attempt to access the ArcGIS Server Administrator Directory on a site that is federated with a portal, you must either provide a portal token generated for a portal administrator or publisher or the primary site administrator name and password. The token is an encrypted string of characters that proves you have provided credentials to the portal.
When you attempt to access the ArcGIS Server Services Directory on a site that is federated with ArcGIS Server, you do not need to provide a token. You'll log in using your portal credentials. You cannot log in using the primary site administrator name and password.
Generating a portal token
The Administrator Directory login page provides a link to a separate page where you can type in a name, password, and URL to generate the token. The login page provides some text explaining how to format the URL.
When entering the URL in the Generate Token page, use only the Webapp URL field (as shown in the graphic below). Selecting any other option, such as IP Address or IP Address of this request's origin, is not supported and may generate an invalid token.
Once the token appears on the screen, you must copy it and paste it into the login page for the Administrator Directory. You can then log in and access these REST resources.
The page for generating a token is always available on your portal using the following URL format: https://webadaptorhost.domain.com/webadaptorname/sharing/rest/generateToken.