1

The Snapchat Marketing API outlines authentication in the following steps:

1.) Open the authorize link in the browser:

https://accounts.snapchat.com/login/oauth2/authorize?response_type=code&client_id={client_id}&redirect_uri={redirect_uri}&scope=snapchat-marketing-api&state=wmKkg0TWgppW8PTBZ20sldUmF7hwvU

2.) Authenticated user clicks the authorize button

3.) Physically copy the code out of the browser address bar

4.) Issue an API/cURL request- exchanging the authorization code for an access token

5.) When the access token expires- exchange a refresh token (from step 4) for a new one.


My main issue with these steps is that the flow is a hybrid web flow/client credentials flow. I am completely dependent upon a browser session to create an access token.

Furthermore, the code obtained from step 3 needs to be regenerated each time an access token is created with it.

There is no [obvious] way to programmatically create an access token. Is there? Even my Selenium attempts trigger a Captcha ...

mykisscool
  • 852
  • 2
  • 9
  • 24

1 Answers1

4

Turns out - permanently caching/storing the refresh_token was the ticket. With it- I can repeat step #5 above ad infinitum.

mykisscool
  • 852
  • 2
  • 9
  • 24