I
Immich2y ago
Gb

caddy + oauth

Hi, Im trying to setup oauth with authentik and caddy as a reverse proxy, however when I enable oauth im greated with a internal server error and no "login with oauth" button is populated. Everything works with normal user + pass login. Caddyfile: REDACTED { reverseproxy 192.168.1.10:2283 } chrome logs: (anonymous) @ indehandle-error.fd12a3ed.js:1 [handleError]: Unable to connect!  {message: 'Request failed with status code 500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE', config: {…}, request: XMLHttpRequest, …}code: "ERR_BAD_RESPONSE"config: {transitional: {…}, transformRequest: Array(1), transformResponse: Array(1), timeout: 0, adapter: ƒ, …}adapter: ƒ (u)data: "{"redirectUri":"https://REDACTED/auth/login\"}"env: {FormData: null}headers: {Accept: 'application/json, text/plain, /', Content-Type: 'application/json'}maxBodyLength: -1maxContentLength: -1method: "post"timeout: 0transformRequest: [ƒ]transformResponse: [ƒ]transitional: {silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false}url: "/api/oauth/config"validateStatus: ƒ (r)xsrfCookieName: "XSRF-TOKEN"xsrfHeaderName: "X-XSRF-TOKEN"[[Prototype]]: Objectmessage: "Request failed with status code 500"name: "AxiosError"request: XMLHttpRequestonabort: ƒ ()onerror: ƒ ()onload: nullonloadend: ƒ me()onloadstart: nullonprogress: nullonreadystatechange: nullontimeout: ƒ ()privateTokenOperationError: nullreadyState: 4response: "{"statusCode":500,"message":"Internal server error"}"responseText: "{"statusCode":500,"message":"Internal server error"}"responseType: ""responseURL: "https://REDACTED/api/oauth/config"responseXML: nullstatus: 500statusText: ""timeout: 0upload: XMLHttpRequestUpload {onloadstart: null, onprogress: null, onabort: null, onerror: null, onload: null, …}withCredentials: false[[Prototype]]: XMLHttpRequestresponse: {data: {…}, status: 500, statusText: '', headers: {…}, config: {…}, …}[[Prototype]]: Error
5 Replies
Gb
GbOP2y ago
Immich-server logs: [Nest] 7 - 08/09/2023, 11:06:57 AM ERROR [ExceptionsHandler] expected 200 OK, got: 404 Not Found OPError: expected 200 OK, got: 404 Not Found at processResponse (/usr/src/app/node_modules/openid-client/lib/helpers/process_response.js:41:11) at Issuer.discover (/usr/src/app/node_modules/openid-client/lib/issuer.js:179:18) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async AuthService.getOAuthClient (/usr/src/app/dist/domain/auth/auth.service.js:225:24) at async AuthService.generateConfig (/usr/src/app/dist/domain/auth/auth.service.js:145:22) at async /usr/src/app/node_modules/@nestjs/core/router/router-execution-context.js:46:28 at async /usr/src/app/node_modules/@nestjs/core/router/router-proxy.js:9:17 its as if the api/oauth endpoint doesnt exist
bo0tzz
bo0tzz2y ago
It's hitting the endpoint, I think this error is from immich trying to reach the oauth server
jrasm91
jrasm912y ago
Immich needs to be able to connect to the auth server from inside the immich-server container as well as from the web client and/or mobile device. Make sure the issuer url returns valid json.
Gb
GbOP2y ago
Okay, ill get on it when I get home. However better error handling could be implemented. Also some kind of test/validation feature in oauth setting would be tremendous! I got it working, thanks. It was indeed the issuer url 😁
jrasm91
jrasm912y ago
Both good suggestions.

Did you find this page helpful?