Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invalidate session only if access token errors when extending token
Summary: Currently when there is a Platform API call that has any error or if there is a connection error, e.g. timeout, the access token is invalidated. This was due to diff D378197 where any errors call invalidSession. To fix this narrow the invalidate call to the scenario where the access token has expired when an API call is made. For now, only REST API error codes allow us to easily identify an invalid token (error code 190). A separate diff will be implemented by the Platform team to provide an error code for Graph API auth token errors. Test Plan: Case #1 1/ Login 2/ Tap Graph API 3/ Tap Get your friends 4/ Go off LAN and WiFi 5/ Tap Get your friends Case #2 1/ Turn WiFi back on 2/ Tap Get your friends 3/ See friends list 4/ Go back to get to Graph API page 5/ Remove app from https://www.facebook.com/settings/?tab=applications 6/ Tap Get your friends Case #3 1/ Temporarily modified code to force a Graph API error //[[delegate facebook] requestWithGraphPath:@"me" andParams:params andDelegate:self]; [[delegate facebook] requestWithGraphPath:@"000000" andParams:params andDelegate:self]; 2/ Tap Graph API 3/ Tap Get your information Before this change, here were the results Case #1: Session expires message, which is incorrect behavior Case #2: Session expires message, which is correct behavior Case #3: Session expires message, which is incorrect behavior After this change, here are the results Case #1: Get the Hackbook "Oops something went wrong" message, which is desired behavior Case #2: Get the Hackbook "Oops something went wrong" message, which is not ideal, user should also be logged out Case #3: Get the Hackbook "Oops something went wrong" message, which is desired behavior Reviewers: yariv, jimbru, brent, toddkrabach, jonathan Reviewed By: yariv CC: lshepard, selekman, beau, bgolub, danmuriello, jacl Differential Revision: https://phabricator.fb.com/D402481 Revert Plan: OK Task ID: 900407
- Loading branch information
daed6b2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I applaud this commit. Thank you @caabernathy!