If you're waiting any period of time between getting the verification code and using it, that's probably the issue. The verification codes are live for only a few seconds before they expire. You want to automate this to make sure the get access token step is completed immediately after the first call is made to begin the authentication flow.
Partner API Support Engineer
View API documentation, code samples, get your API key.