pythonamazon-web-servicesoauth-2.0aws-lambdastocktwits

Stocktwits API - get access token from script without user interaction


Is there a possibility to retrieve access token just from script in aws lambda without user interaction in the next way? =>

url = f'https://{user}:{password}@api.stocktwits.com/api/2/oauth/authorize?client_id={client_id}&response_type=token&redirect_uri={redirect_uri}&scope=publish_messages'

response = requests.get(
    url, allow_redirects=True
)

For this moment I only retrieve redirect to => https://api.stocktwits.com/api/2/oauth/signin?


Solution

  • There is a plethora of solutions for this question. I'm assuming you are redirecting to an oauth page where it's requesting a sign in form? If that is the case one way you could do it is drive that page with selenium and have it fill in the credentials for you then you will be able to retrieve the access token.