Hi Dave,
If you set the token for a layer, the layer doesn't know the referer the token has been generated for.
As a consequence, the referer is not set when requesting the resource and the request fails due to an invalid token.
To get it working you have to let the IdentityManager set the token.
Once you get the credential, add it to IM using AddCredential. The credential object encapsulates the token and the referer. This referer will be used by the IM when requesting the resource.
Note: for the new .Net API, we are considering adding a default referer for all requests instead of a default referer for the token generation only.
/Dominique