Can plugin oauth2-basic convert text to json?

To log in with WECHAT account, I tried to use plugin oatuh2-basic but meet a problem.

Usually, WECHAT server should return applicaion/json, then the plugin can read USID in the json string.

Unfortunatly, the server just return text/plain, which cannot be read by the plugin.

Here is the result. One has logged in with WEIBO successfully, and the other one tried to login in with WECHAT but failed.

I tried to modify the plugin’s code but failed, cause I have no idea how to deal with ruby language.

So can someone tell me where the code should be edited? Or is there any possibility that the plugin could be updated?

here is the backtrace

Message

(oauth2_basic) Authentication failure! invalid_credentials: OAuth2::Error, {"access_token":"60_xf-0xS4znmnu9z-2ZDhNN40RRluErfbiThzzoDz9p8-Ki9pH-A3ML2n3q6UhT7D6d6iCXlEVS5B7kGFsnhW2JHq6eXHNWOgzqXqMsAvhfY4","expires_in":7200,"refresh_token":"60_gfsBHpp0btOnWaZpnRXMywNTzDURCymRtw8sQj21XXC99aebh58Mb4vBGiKaXdYqDGkdovn2ytFoiqavsSWHLt_UiExbkPYA0z-4DBVjDlA","openid":"o01u45oBVM2YbPzmxXau263z_iW4","scope":"snsapi_base"}

Backtrace

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/omniauth-1.9.2/lib/omniauth/strategy.rb:163:in `log'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/omniauth-1.9.2/lib/omniauth/strategy.rb:486:in `fail!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/omniauth-oauth2-1.7.2/lib/omniauth/strategies/oauth2.rb:96:in `rescue in callback_phase'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/omniauth-oauth2-1.7.2/lib/omniauth/strategies/oauth2.rb:84:in `callback_phase'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/omniauth-1.9.2/lib/omniauth/strategy.rb:238:in `callback_call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/omniauth-1.9.2/lib/omniauth/strategy.rb:189:in `call!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/omniauth-1.9.2/lib/omniauth/strategy.rb:169:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/omniauth-1.9.2/lib/omniauth/strategy.rb:192:in `call!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/omniauth-1.9.2/lib/omniauth/strategy.rb:169:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/omniauth-1.9.2/lib/omniauth/strategy.rb:192:in `call!'

Env

HTTP HOSTS: frps.southdog.cool

给中国同胞指条明路,在
容器/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/oauth2-1.4.7/lib/oauth2/response.rb 中,存在下面这段代码

    # Content type assignments for various potential HTTP content types.
    @@content_types = {
      'application/json' => :json,
      ………………
      'text/plain' => :text,
    }

改成下面这样:

'text/plain' => :json,

当然,应该只对微信有用,因为只有微信会返回text