change context in terminal methods, to access terminal when defined by users, add globalToken to duplicated get_token function