I am trying to connect a Discourse installation with a Drupal installation via OAuth2, as described in this post.

Modules:

  • OAuth2 Login Provider
  • OAuth2 Server
  • Services
  • REST Server

Expected:
Callback to http://DRUPAL/oauth2/user/profile should not return 404

Actual:
In DISCOURSE logs, the following error appears:

OpenURI::HTTPError (404 Not found : Could not find the controller.)
/usr/local/lib/ruby/2.0.0/open-uri.rb:353:in 'open_http'

In the DRUPAL system's apache logs, the following error appears:
DRUPAL x.x.x.x - - [04/May/2016:00:19:42 -0000] "GET /oauth2/user/profile HTTP/1.1" 404 4382 "-" "Ruby"

Any thoughts on how to move forward from here, or how to properly test /oauth2/user/profile to see why it gives a 404?

Comments

tarek created an issue. See original summary.

dashohoxha’s picture

In the Drupal logs you have GET /oauth2/user/profile HTTP/1.1, but the homepage of oauth2_loginprovider explicitly says that you need a POST request:

clients can access the user profile with a POST request at: https://server.example.org/oauth2/user/profile (after being authenticated and having an access_token).

dashohoxha’s picture

dashohoxha’s picture

Category: Bug report » Support request
tarek’s picture

Thank you very much. I will try this and get back to you. Thank you. Also, is there no way to make it accept GET as well?

tarek : )

tarek’s picture

I have filed a bug with discourse related to lack of POST support in callback.

tarek : )

dashohoxha’s picture

is there no way to make it accept GET as well?

oauth2_loginprovider depends on oauth2_server, and as far as I know (if things have not changed lately), oauth2_server accepts the access token only through the HTTP header "Authorization: Bearer access_token", not in th URL, and the request has to be a POST request. They argue that this is in compliance with OAuth2 standards. So, I think that it will not work if I tried to make it accept a GET request.

dashohoxha’s picture

is there no way to make it accept GET as well?

I will give it a try.

dashohoxha’s picture

Title: callback URL returns 404 » Support the GET request (besides the POST request)
Assigned: Unassigned » dashohoxha
Category: Support request » Feature request
dashohoxha’s picture

Status: Active » Fixed
Issue tags: -bug +feature

Fixed by this commit: http://cgit.drupalcode.org/oauth2_loginprovider/commit/?id=e91085e
A new version that includes this feature will be released soon.

dashohoxha’s picture

@tarek, you can test the new release and, if it works as expected, close this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.