Added token API and tests
Minor change in token authorization