Removes charakters from returned token

It turned out that a token is returned as string containing characters and white space. This caused a bug when preferences are fetched from server. This commit fix this bug by removing characters from a token