1

I've been going through OAuth2 Server module setup Documentation/Guidelines for almost 2 days now, and also referred with friend who has this working. But unable to get this working properly.

I've a Drupal 7 Site already in use for quite some time (3-4 years). We're building few more applications (in other PHP Framework - not using Drupal), where we want to use/share users from this existing D7 site. To achieve this, we're making existing D7 site as Authentication Server by implementing OAuth2 Server module and OpenID Connect Single Sign-on module. I've configured it as per documentation provided on OAuth2 Server Page.

As a Test client to quickly setup and test, I've setup Another fresh D7 setup and configured OpenID Connect Module and OpenID Connect Single Sign-on module.

Both these Server and Clients are setup/configured using the Steps provided on OpenID Connect Single Sign-on Documentation and also includes HTTPS in URL (self-signed).


Problem:

  1. Now when trying to login on Client using "Log in with Generic" button provided by OpenID Connect Module, the authentication takes me to Server for login where I put my login details and it takes me back to Client. At this stage I'm logged into Server but not on client. When debug more about this I found that in client, I receive below log in Recent Logs:

Location : https://client.local.com/openid-connect/generic?code=026ebfd35389b9e3a667a03eb778cdab4d3cc3e4&state=iNaaCcI4pxxZXssUAIO9gdz2Nm8zG5RbhsQ25azigYw

Message : Could not retrieve tokens (0 Error opening socket ssl://server.local.com:443). Details:

  1. Now, if I go to Client OpenID Connect Module's configuration and change the 3 Endpoints URLs from https to http and try to login and follow the steps, I'm able to login. (Note: Server is using http and client is using https - In this case, it asks to login 2 times, one on http and another on https).
  2. Another problem I'm facing after #2 is, when I'm trying to login/logout from client site, it takes me to server or vice versa and only one (either server/client) shows latest updates about login/logout, where I've triggered the event.

Other information:

OS: currently Windows 8 with XAMPP (production uses CentOS)
Drupal Version: 7.52/7.53
PHP Version: 7.0.3

Any help is greatly appreciated.


Edit 1:

  1. Added debug info for #1.
  2. I've also tried configuring another clean Drupal installation as OAuth2 Server, but in that also I'm facing similar issue.

Edit 2:

After some more research found this issue, which mentions that

The behavior of drupal_http_request() changes, because PHP 7 has changed the defaults regarding the ssl options.

This makes code fail that relies on issuing a http request to a https version of a site, which uses a self-signed certificate.

After applying changes in issue for 'context', Problem 1 and 2 seems to be fixed. i.e. User is getting logged in both Sites, and authorization is working with https enabled endpoint URL as well.

But Problem 3 remains there, i.e. when user try to login in client it take user to server for authorization and stays in server only. User is not re-directed back to client.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.