-
Notifications
You must be signed in to change notification settings - Fork 13.5k
custom oauth, for the identity path rocket chat requests html instead of json #13331
Description
Description:
custom oauth, for the identity path rocket chat requests html instead of json.
Steps to reproduce:
i guess just use a custom oauth and check the request format
Expected behavior:
it should request 'application/json'
Actual behavior:
request.formats: ["text/html"]
Server Setup Information:
- Version of Rocket.Chat Server: 0.74.0
- Operating System: Ubuntu 16.04
- Deployment Method: manual install
- Number of Running Instances: 1
- DB Replicaset Oplog: n/a
- NodeJS Version: v8.11.3
- MongoDB Version: 3.4.19
Additional context
Relevant logs:
oauth provider log:
`I, [2019-02-03T18:35:36.288129 #19842] INFO -- : [7e609be3-a80d-470a-892e-ae3e43f55159] Started GET "//oauth/authorize?client_id=83a4bf1f9037b3c5659e77c235b437ac3508b411890b2a92c892f9e0662e4cd6&redirect_uri=https://snip/_oauth/snip&response_type=code&state=eyJsb2dpblN0eWxlIjoicmVkaXJlY3QiLCJjcmVkZW50aWFsVG9rZW4iOiJrWXN4TGhVczRnQTZzal83Vm4yck5EbUtOUnpUb2FIbnIzcVFJczdmWWtlIiwiaXNDb3Jkb3ZhIjpmYWxzZSwicmVkaXJlY3RVcmwiOiJodHRwczovL3NtYmNoYXQuYWxwaGEtaXQtc29sdXRpb25zLmRlL2hvbWUifQ==&scope=user:authenticate" for 46.125.39.51 at 2019-02-03 18:35:36 +0100
I, [2019-02-03T18:35:36.290141 #19842] INFO -- : [7e609be3-a80d-470a-892e-ae3e43f55159] Processing by Doorkeeper::AuthorizationsController#new as HTML
I, [2019-02-03T18:35:36.290353 #19842] INFO -- : [7e609be3-a80d-470a-892e-ae3e43f55159] Parameters: {"client_id"=>"83a4bf1f9037b3c5659e77c235b437ac3508b411890b2a92c892f9e0662e4cd6", "redirect_uri"=>"https://snip/_oauth/snip", "response_type"=>"code", "state"=>"eyJsb2dpblN0eWxlIjoicmVkaXJlY3QiLCJjcmVkZW50aWFsVG9rZW4iOiJrWXN4TGhVczRnQTZzal83Vm4yck5EbUtOUnpUb2FIbnIzcVFJczdmWWtlIiwiaXNDb3Jkb3ZhIjpmYWxzZSwicmVkaXJlY3RVcmwiOiJodHRwczovL3NtYmNoYXQuYWxwaGEtaXQtc29sdXRpb25zLmRlL2hvbWUifQ==", "scope"=>"user:authenticate"}
I, [2019-02-03T18:35:36.372593 #19842] INFO -- : [7e609be3-a80d-470a-892e-ae3e43f55159] Redirected to https://snip/_oauth/snip?code=781439dfc83f6ff4bedf875fc809a4fff0c49c15667c51f06892c8cc3ed666be&state=eyJsb2dpblN0eWxlIjoicmVkaXJlY3QiLCJjcmVkZW50aWFsVG9rZW4iOiJrWXN4TGhVczRnQTZzal83Vm4yck5EbUtOUnpUb2FIbnIzcVFJczdmWWtlIiwiaXNDb3Jkb3ZhIjpmYWxzZSwicmVkaXJlY3RVcmwiOiJodHRwczovL3NtYmNoYXQuYWxwaGEtaXQtc29sdXRpb25zLmRlL2hvbWUifQ%3D%3D
I, [2019-02-03T18:35:36.372851 #19842] INFO -- : [7e609be3-a80d-470a-892e-ae3e43f55159] Completed 302 Found in 82ms (ActiveRecord: 60.5ms)
I, [2019-02-03T18:35:36.469880 #19842] INFO -- : [88d771f7-d582-4538-afd5-d6a301b311ab] Started POST "/oauth/token" for 148.251.155.82 at 2019-02-03 18:35:36 +0100
I, [2019-02-03T18:35:36.471360 #19842] INFO -- : [88d771f7-d582-4538-afd5-d6a301b311ab] Processing by Doorkeeper::TokensController#create as JSON
I, [2019-02-03T18:35:36.471497 #19842] INFO -- : [88d771f7-d582-4538-afd5-d6a301b311ab] Parameters: {"code"=>"[FILTERED]", "redirect_uri"=>"https://snip/_oauth/snip", "grant_type"=>"authorization_code", "state"=>"eyJsb2dpblN0eWxlIjoicmVkaXJlY3QiLCJjcmVkZW50aWFsVG9rZW4iOiJrWXN4TGhVczRnQTZzal83Vm4yck5EbUtOUnpUb2FIbnIzcVFJczdmWWtlIiwiaXNDb3Jkb3ZhIjpmYWxzZSwicmVkaXJlY3RVcmwiOiJodHRwczovL3NtYmNoYXQuYWxwaGEtaXQtc29sdXRpb25zLmRlL2hvbWUifQ=="}
I, [2019-02-03T18:35:36.490541 #19842] INFO -- : [88d771f7-d582-4538-afd5-d6a301b311ab] Completed 200 OK in 19ms
I, [2019-02-03T18:35:36.494635 #19842] INFO -- : [525bb631-a379-433a-8002-79ce5da4ea4b] Started GET "/api/v1/users/me" for 148.251.155.82 at 2019-02-03 18:35:36 +0100
I, [2019-02-03T18:35:36.495236 #19842] INFO -- : [525bb631-a379-433a-8002-79ce5da4ea4b] Processing by Api::V1::Users::UsersController#me as HTML
I, [2019-02-03T18:35:36.495938 #19842] INFO -- : [525bb631-a379-433a-8002-79ce5da4ea4b] Completed 406 Not Acceptable in 1ms (ActiveRecord: 0.0ms)
F, [2019-02-03T18:35:36.496779 #19842] FATAL -- : [525bb631-a379-433a-8002-79ce5da4ea4b]
F, [2019-02-03T18:35:36.496812 #19842] FATAL -- : [525bb631-a379-433a-8002-79ce5da4ea4b]
ActionController::UnknownFormat (Api::V1::Users::UsersController#me is missing a template for this request format and variant.
request.formats: ["text/html"]
request.variant: []
NOTE! For XHR/Ajax or API requests, this action would normally respond with 204 No Content: an empty white screen. Since you're loading it in a web browser, we assume that you expected to actually render a template, not nothing, so we're showing an error to be extra-clear. If you expect 204 No Content, carry on. That's what you'll get from an XHR or API request. Give it a shot.):
F, [2019-02-03T18:35:36.496831 #19842] FATAL -- : [525bb631-a379-433a-8002-79ce5da4ea4b]
F, [2019-02-03T18:35:36.496888 #19842] FATAL -- : [525bb631-a379-433a-8002-79ce5da4ea4b] actionpack (5.2.2) lib/action_controller/metal/implicit_render.rb:55:in default_render'
rocket chat log:
Exception while invoking method 'login' { Error: Failed to fetch identity from snip at https://snip/api/v1/users/me. failed [406] at CustomOAuth.getIdentity (packages/rocketchat:custom-oauth/server/custom_oauth_server.js:166:18) at Object.OAuth.registerService.query [as handleOauthRequest] (packages/rocketchat:custom-oauth/server/custom_oauth_server.js:177:24) at OAuth._requestHandlers.(anonymous function) (packages/oauth2/oauth2_server.js:10:33) at middleware (packages/oauth/oauth_server.js:161:5) at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40 message: 'Failed to fetch identity from snip at https://snip/api/v1/users/me. failed [406]', response: { statusCode: 406, content: '', headers: { 'content-type': 'text/html; charset=UTF-8', 'content-length': '0', connection: 'close', status: '406 Not Acceptable', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'x-request-id': '525bb631-a379-433a-8002-79ce5da4ea4b', 'x-runtime': '0.002550', date: 'Sun, 03 Feb 2019 17:35:36 GMT', 'set-cookie': [Array], 'x-powered-by': 'Phusion Passenger 6.0.1', server: 'nginx/1.15.8 + Phusion Passenger 6.0.1' }, data: null } }