Implement stack determination. Implement OAuth token refresh.