parse-community / ParseFacebookUtils-Android

A utility library to authenticate ParseUsers with the Facebook SDK
http://docs.parseplatform.org/android/guide/#facebook-users
Other
53 stars 63 forks source link

Fixing Facebook Auth for permissions #25

Closed HIFILEO closed 7 years ago

HIFILEO commented 7 years ago

Problem

When logging into facebook using parse in order to update facebook AccessToken permissions, the AccessToken permissions get set to 0.

Steps to reproduce

  1. Log into facebook using parse. Request "user_friends". Accept the permission.
  2. Remove "user_friends" permission from facebook app settings under your user. (Use browser)
  3. Have app log into facebook for read permission using parse. Get AccessToken. Watch permissions go to 0.

Solution

The solution was to write the permissions to facebook AccessToken any time they were available. This code was missing. I also added checks for last refresh. If you choose to login into parse using facebook auth, don't overwrite the facebook auth if the parse auth is OLDER.

Testing

Test was added to check for permissions when passing them through FacebookController.

codecov[bot] commented 7 years ago

Codecov Report

Merging #25 into master will increase coverage by 0.42%. The diff coverage is 62.5%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #25      +/-   ##
============================================
+ Coverage      57.3%   57.73%   +0.42%     
- Complexity       35       36       +1     
============================================
  Files             2        2              
  Lines           178      194      +16     
  Branches         18       22       +4     
============================================
+ Hits            102      112      +10     
- Misses           69       73       +4     
- Partials          7        9       +2
Impacted Files Coverage Δ Complexity Δ
...ry/src/main/java/com/parse/FacebookController.java 75.58% <62.5%> (-3%) 15 <0> (+1)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 61d8a01...090c32d. Read the comment docs.

rogerhu commented 7 years ago

thanks for fixing!