Facebook Authentication Implementation

2019-03-16 08:10发布

I'm working on a project which will use facebook authentication completely (no custom authentication implementation exists). Project uses PHP for server-side scripting. I looked around for implementing fast and secure authentication mechanism but i cannot find any detailed description about this subject. Facebook's documents are weak and does only provide basic information.

Which authentication method would be appropriate? There's a Javascript SDK and PHP SDK. As i understand, i have to use Javascript SDK for login, then using PHP SDK i will check my database for verifying credentials. But using Graph API with PHP SDK is slow. Is there a better way to validate session?

Will i need to check session server-side (PHP-SDK) on every request?

7条回答
相关推荐>>
2楼-- · 2019-03-16 08:53

You can use one or the other or both.

You can use PHP SDK to generate the relevant URL's to send people to. And just wack that on a link. Or you can use Javascript to make the Facebook Default login button.

After that you can use one or the other to maintain and verify the session.

I generally use PHP to do he grunt work with oAuth keys and use JavaScript SDK to make the nice Facebook buttons and some minor less important graph calls for session monitoring.

Anything that involves any heavy or multiple graph calls I push to PHP.

But there is flexibility there to do what you want. You don't have to use JavaScript SDK for login.

It's up to you if you want to verify every page load or not.

I tend to use the Javascript SDK to handle it and like Berk if the session is dead. Call a page redirect to a logout script.

查看更多
登录 后发表回答