SnapchatBot icon indicating copy to clipboard operation
SnapchatBot copied to clipboard

Prevent Snapchat's Forced Logout

Open neuegram opened this issue 9 years ago • 6 comments

I'm sure in testing y'all have noticed it logs you out whenever you login elsewhere. This is a problem for 3rd party apps on iOS / Android / Etc. I've come up with a way to connect with the Snapchat API while avoiding this. I'm not sure of its limitations, but at the very least it should be able to retrieve snaps.

neuegram avatar Mar 13 '15 04:03 neuegram

What's your way?

Mine is simply running an infinite loop where you create a bot and log in. I catch HTTPErrors and another one I can't quite remember, I wait 3 minutes before continuing the loop.

Rob-- avatar Mar 13 '15 08:03 Rob--

My method uses Apple's notification system. I realized that even after logging out, notifications continue. I have plans to reverse-engineer this connection to Apple's push servers, although it won't be easy.

neuegram avatar Mar 13 '15 14:03 neuegram

The most lightweight way to do this is probably to retry logging in if you get a 400 error when performing any of the bot methods. I think I'll make a decorator for all the bot methods that does that.

@neuegram is there code available somewhere with your approach?

agermanidis avatar Mar 13 '15 17:03 agermanidis

I'm working on reversing it. It's a pain because iOS notifications won't route through a proxy specified in network settings and they are certificate pinning. This could work well for getting around future blocks on Snapchat's end.

neuegram avatar Mar 13 '15 17:03 neuegram

@neuegram notifications don't necessarily continue after "logging out". If you're on an account on your phone and you close Snapchat and log into the account on your computer you will continue receiving notifications because Snapchat isn't open and therefore (I think) it doesn't send any requests to the API so the servers don't know you're actually still logged in. If you were to open the app again and refresh anything, you would be logged out after sending the request because the computer has a session open.

Rob-- avatar Mar 13 '15 18:03 Rob--

This is evidence that the background requests don't rely on auth_tokens, which could also serve as a vulnerability.

neuegram avatar Mar 13 '15 20:03 neuegram