How to use OpenID for authentication?

Hi. I want to implement an authentication system on my web site using OpenID so that users will log in with Facebook or Google.

A working example would be nice.
Most libraries are outdated and I am trying to use the following library, but the tutorial is terrible and doesn’t explain how to redirect the user to login page and doesn’t explain the basic concepts of OpenID.

This is what I need to do, but I don’t know how to do:
-Check if the user has logged in.
-Put a button that sends the user to a page where they can log in with Facebook or Google.
-Write a PHP page that receives the response from OpenID.

Thanks for any help.

To start with, support for openid pretty much ended in the Summer of 2018. What you really want is oauth2. More or less the same thing but it might explain why you are having trouble finding good examples.

In my opinion it is useful to understand the oauth2 protocol by implementing something for one provider. Once you get that working it becomes fairly easy to add additional providers or perhaps to switch to a third party library.

I poked around a bit and this codex example seems to be reasonably up to date. I have not actually stepped through it myself in detail but it seems to be a decent place to start.

1 Like

3 posts were split to a new topic: OpenID vs OAuth2

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.