Extracting common code to private method

Created a private method to build URL queries.

Change-Id: Iaa480443e34073fa39d13d2452cd13c267a2bdd5
Log token with sha1

By logging the sha1 hash of the token, it can be tracked through
different services.

Closes-bug: #1329301
Change-Id: I9c338f6a418ab8dd34dbaaf918b0ea6e9cbe79d7
Merge "Extracting common code to private method"
Merge "Log token with sha1"