Kjq/longtoken support (after user-api and platform-client changes)

Almost all the changes are cosmetic; I have marked the one real change.