qinyj
(qinyj)
August 30, 2022, 5:35pm
1
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?
qinyj
(qinyj)
August 31, 2022, 4:01pm
4
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
qinyj
(qinyj)
September 8, 2022, 4:24pm
7
Show Chinese compatriots a way forward. In the container /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/oauth2-1.4.7/lib/oauth2/response.rb, the following code exists:
# Content type assignments for various potential HTTP content types.
@@content_types = {
'application/json' => :json,
………………
'text/plain' => :text,
}
Change it to the following:
'text/plain' => :json,
Of course, this should only be useful for WeChat, as only WeChat returns text.
system
(system)
Closed
October 8, 2022, 4:24pm
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.