extract and store the token in a global variable