My version of this is in the file demo/oauth.pl
Use server. To run the code, you need to have a local copy of the client secrets json file and have your google app set up correctly.
Use google chrome and browse localhost:5000 and show the javascript console to see the token.
This pack deals with "Login With Google" using OpenID Connect (OAuth 2.0 for Login). The code is partially based on pl-oauth2client-for-google
To run the code
-
Follow these steps to create a Google project and get
- A client ID
- A client secret
- Register a redirect url. To test from localhost, this should be
http://localhost:3040/oauth2/auth_redirect
-
Edit
demo/test.pl
, fill in the client id and client secret. Start Prolog withdemo/test.pl
and run the command below to start the server.?- server.
-
Go to
http://localhost:3040
and hit the button. After logging in this should show a Prolog dict holding the Google profile information.
Requires SWI-Prolog 7.1.30 or later (to be released, use version from GIT or nightly builds for Windows