Can get the access token but when I run the full script does not work and throws below error. 