最近在做海外市场的应用,接入Facebook登录认证。

  1. get token(client): https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow#confirm
  2. verify token(server): https://stackoverflow.com/a/8608017/2445042

    # facebook auth2
    # curl -sSL 'https://graph.facebook.com/me?access_token=XXX'
    curl -sSL 'https://graph.facebook.com/me?access_token=EAAMKdhBsxkYBAMFhvAw0Umgi2HblH1SXMcu6LawznlMs8f5cbvNylCywOIn3pfgX4Bp5G8Nz2Vn9ZAtx6k6GtOlxFD1PVAW9yiivT7sZAMTH26Sgg***SECRET***BVaNmV7QhSSJqmYyS4cYuK894eEp3wDBxtvJCJV0eJ7UlsXQh6e6TBJ5gNHDHBlHJsAAv4MuRoAqVLJ1xKjNVmZBmAc2zhTSrKOurmbea1'
    
    {
    "name": "Ch** **n",
    "id": "601289***529408"
    }
    

会返回第三方登录用户的唯一ID,还有用户昵称,录入数据库即可。