add error handling for exchanging tokens
separate the request from the post call when exchanging tokens