# \[Invalid\] Omniauth callback does not support POST, only GET

**URL:** https://meta.discourse.org/t/invalid-omniauth-callback-does-not-support-post-only-get/43741
**Category:** Bug
**Created:** [May 5, 2016, 3:34pm UTC](https://meta.discourse.org/t/invalid-omniauth-callback-does-not-support-post-only-get/43741 "2016-05-05T15:34:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tarek/32/124831_2.png) [@tarek](https://meta.discourse.org/u/tarek)
#### Post date: [May 5, 2016, 3:34pm UTC](https://meta.discourse.org/t/invalid-omniauth-callback-does-not-support-post-only-get/43741/1 "2016-05-05T15:34:53Z")

</div>

Hello all,

I am trying to implement [OAuth2 Basic](https://meta.discourse.org/t/oauth2-basic-support/33879/58) with @dashohoxha’s Drupal plugin [oauth2\_loginprovider](https://www.drupal.org/project/oauth2_loginprovider).

I get an error during the callback:

> [@OAuth2 integration with Drupal](https://meta.discourse.org/t/oauth2-integration-with-drupal/43652/1):
>
> 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”

As @dashohoxha [noted](https://www.drupal.org/node/2718525), it appears that the error is related to GET instead of POST:

> [@dashohoxha](#):
>
> 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](https://server.example.org/oauth2/user/profile) (after being authenticated and having an access\_token).

As I looked, there appears to be no way to change this behaviour via plugin. Any ideas?

tarek : )

---

<div class="post-metadata">

### Author: ![tarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tarek/32/124831_2.png) [@tarek](https://meta.discourse.org/u/tarek)
#### Post date: [May 5, 2016, 4:38pm UTC](https://meta.discourse.org/t/invalid-omniauth-callback-does-not-support-post-only-get/43741/2 "2016-05-05T16:38:17Z")

</div>

It appears this is the offending line, which would make it a problem of [OAuth2 Basic](https://meta.discourse.org/t/oauth2-basic-support/) and not callback in general.

From `discourse-oauth2-basic/plugin.rb:53:in 'fetch_user_details'`:

```ruby
user_json = JSON.parse(open(user_json_url, 'Authorization' => "Bearer #{token}" ).read)

```

From trying to debug this on IRC, it appears that:

```plaintext
[12:31:56] <jmarinelli> open-uri only supports GET
[12:32:42] <jmarinelli> look into HTTParty, or Net::HTTP if you don't want to add dependencies
[12:32:55] <havenwood> You could use Net::HTTP from the stdlib but it's a bit unwieldy. I'd suggest HTTP.rb for a gem: https://github.com/httprb/http#readme

```

I will post this all to the OAuth2 Basic site. How do I close this topic?

tarek : )

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 5, 2016, 8:41pm UTC](https://meta.discourse.org/t/invalid-omniauth-callback-does-not-support-post-only-get/43741/3 "2016-05-05T20:41:36Z")

</div>


