curved-ram-6189
06/12/2023, 1:03 PMproud-plumber-24205
06/12/2023, 1:23 PMredirect_uri
in these circumstances, kratos has no authority to redirect the user to anywhere other than back to hydra.curved-ram-6189
06/12/2023, 1:28 PMcurved-ram-6189
06/12/2023, 1:30 PMselfservice:
methods:
password:
enabled: true
config:
haveibeenpwned_enabled: false
oidc:
enabled: true
allowed_return_urls:
- <http://localhost>
- <https://oauth.pstmn.io/v1/callback>
- https://$(BASE_DOMAIN)/kratos/ui/
flows:
login:
ui_url: https://$(BASE_DOMAIN)/kratos/ui/login
after:
default_browser_return_url: https://$(BASE_DOMAIN)/kratos/ui/
registration:
curved-ram-6189
06/12/2023, 1:30 PMoauth2_provider:
url: <http://hydra-admin:4445>
proud-plumber-24205
06/12/2023, 1:37 PMDoes this mean that I MUST set hydra as the redirect_uri?what do you mean? Kratos can work independent of hydra, and so the
default_browser_return_url
key is exactly what it says. the default url to redirect to after a browser flow.
in an independent flow (no oauth2) a login flow through a browser will return the browser to the default_browser_return_url
or if specified login.after.default_browser_return_url
.curved-ram-6189
06/12/2023, 1:40 PMdefault_browser_return_url
to mean as well.. that it could be overridden by the oauth2 redirect_uri. However that's not the behaviour I'm seeing. If you look at the screenshot you can see that I specify the <https://oauth.pstmn.io/callback>
redirect_uri in the hydra authorize endpoint call, which correctly sends me to the kratos login screen. However kratos login just takes me back to the kratos ui welcome screen if successful (which happens to be what I set as the default_browser_return_url
. I would expect instead to be redirected to <https://oauth.pstmn.io/callback>
So I'm wondering what I need to do to get Kratos to redirect to the proper redirect_uri?curved-ram-6189
06/12/2023, 1:42 PMproud-plumber-24205
06/12/2023, 1:42 PMproud-plumber-24205
06/12/2023, 1:43 PMproud-plumber-24205
06/12/2023, 1:43 PMcurved-ram-6189
06/12/2023, 1:45 PMproud-plumber-24205
06/12/2023, 1:48 PMproud-plumber-24205
06/12/2023, 1:49 PMcurved-ram-6189
06/12/2023, 1:49 PMcurved-ram-6189
06/12/2023, 2:08 PMcurved-ram-6189
06/12/2023, 2:24 PMcookie.same_site: None
. But once I fixed that it still doesn't seem to work. Should the "return_to" parameter in the login/browser call be empty?adorable-scooter-1570
06/12/2023, 3:09 PMselfservice:
methods:
oidc:
enabled: true
password:
enabled: true
config:
haveibeenpwned_enabled: false
adorable-scooter-1570
06/12/2023, 3:09 PMcurved-ram-6189
06/12/2023, 4:14 PMcurved-ram-6189
06/12/2023, 4:15 PMcurved-ram-6189
06/12/2023, 4:29 PMadorable-scooter-1570
06/12/2023, 5:06 PMcurved-ram-6189
06/12/2023, 7:43 PMtime=2023-06-12T19:33:57Z level=info msg=completed handling request http_request=map[headers:map[accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 accept-encoding:gzip, deflate, br accept-language:en-GB,en-US;q=0.9,en;q=0.8 cookie:[ory_hydra_login_csrf_dev_1258758061=MTY4NjU5ODQzN3xSRGNhQ0Ruc2Z1cDBNbDhueVQ1TFhWSjJXeWlvb3BOSUt5bmE4RnVJc0pIOF9NLUgyRTlDcFkzdHptR1JtM3lwS0hUeEJldHc3bE45S053MmNTSGE2dTgwSTB3WUxVdUZ2Sm81YzR5eDdHbkpGN0pzT2V1cHo1bXQxdkNERWc9PXzcMygTZ9ZkVHc1v75jOdQO9C1TcRE2swo-r7ukny7Jfw==] sec-ch-ua:"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111" sec-ch-ua-mobile:?0 sec-ch-ua-platform:"Linux" sec-fetch-dest:document sec-fetch-mode:navigate sec-fetch-site:none sec-fetch-user:?1 upgrade-insecure-requests:1 user-agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 x-forwarded-for:142.177.68.42 x-forwarded-host:<http://domain.com|domain.com> x-forwarded-port:443 x-forwarded-proto:https x-forwarded-scheme:https x-real-ip:142.177.68.42 x-request-id:80a5c6a6da7258d9fcd8ea90972deb3f x-scheme:https] host:<http://domain.com|domain.com> method:GET path:/self-service/login/browser query:aal=&refresh=&return_to= remote:10.0.31.193:52586 scheme:http] http_response=map[headers:map[cache-control:private, no-cache, no-store, must-revalidate content-type:text/html; charset=utf-8 location:<https://domain.com/kratos/ui/login?flow=41447c32-4369-4bc1-a4be-2c04c03cba23> set-cookie:[csrf_token_cdc523be6ce53703e2c61dcec65282dc84d9c5323e86a28b466c961bca11b066=9exMF12lL2EtWJE6Ndgl7sAIbbCzG6hNqnRPfb0IMjo=; Path=/; Max-Age=31536000; HttpOnly; SameSite=Lax] vary:Origin] size:122 status:303 text_status:See Other took:3.729402ms]
time=2023-06-12T19:33:57Z level=info msg=started handling request http_request=map[headers:map[accept:application/json, text/plain, */* connection:close cookie:[ory_hydra_login_csrf_dev_1258758061=MTY4NjU5ODQzN3xSRGNhQ0Ruc2Z1cDBNbDhueVQ1TFhWSjJXeWlvb3BOSUt5bmE4RnVJc0pIOF9NLUgyRTlDcFkzdHptR1JtM3lwS0hUeEJldHc3bE45S053MmNTSGE2dTgwSTB3WUxVdUZ2Sm81YzR5eDdHbkpGN0pzT2V1cHo1bXQxdkNERWc9PXzcMygTZ9ZkVHc1v75jOdQO9C1TcRE2swo-r7ukny7Jfw==; csrf_token_cdc523be6ce53703e2c61dcec65282dc84d9c5323e86a28b466c961bca11b066=9exMF12lL2EtWJE6Ndgl7sAIbbCzG6hNqnRPfb0IMjo=] user-agent:axios/0.21.4] host:kratos-public method:GET path:/self-service/logout/browser query:<nil> remote:10.0.31.158:45426 scheme:http]
time=2023-06-12T19:33:57Z level=info msg=An error occurred while handling a request audience=application error=map[debug: message:request does not have a valid authentication session reason:No active session was found in this request. stack_trace:
<http://github.com/ory/kratos/session.(*ManagerHTTP).FetchFromRequest|github.com/ory/kratos/session.(*ManagerHTTP).FetchFromRequest>
/project/session/manager_http.go:208
<http://github.com/ory/kratos/selfservice/flow/logout.(*Handler).createBrowserLogoutFlow|github.com/ory/kratos/selfservice/flow/logout.(*Handler).createBrowserLogoutFlow>
/project/selfservice/flow/logout/handler.go:128
<http://github.com/ory/kratos/x.NoCacheHandle.func1|github.com/ory/kratos/x.NoCacheHandle.func1>
/project/x/nocache.go:21
<http://github.com/ory/kratos/x.NoCacheHandle.func1|github.com/ory/kratos/x.NoCacheHandle.func1>
/project/x/nocache.go:21
<http://github.com/julienschmidt/httprouter.(*Router).ServeHTTP|github.com/julienschmidt/httprouter.(*Router).ServeHTTP>
/go/pkg/mod/github.com/julienschmidt/httprouter@v1.3.0/router.go:387
<http://github.com/ory/nosurf.(*CSRFHandler).handleSuccess|github.com/ory/nosurf.(*CSRFHandler).handleSuccess>
/go/pkg/mod/github.com/ory/nosurf@v1.2.7/handler.go:234
<http://github.com/ory/nosurf.(*CSRFHandler).ServeHTTP|github.com/ory/nosurf.(*CSRFHandler).ServeHTTP>
/go/pkg/mod/github.com/ory/nosurf@v1.2.7/handler.go:191
<http://github.com/urfave/negroni.Wrap.func1|github.com/urfave/negroni.Wrap.func1>
/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46
<http://github.com/urfave/negroni.HandlerFunc.ServeHTTP|github.com/urfave/negroni.HandlerFunc.ServeHTTP>
/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29
<http://github.com/urfave/negroni.middleware.ServeHTTP|github.com/urfave/negroni.middleware.ServeHTTP>
/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
<http://github.com/ory/kratos/x.glob..func1|github.com/ory/kratos/x.glob..func1>
/project/x/clean_url.go:15
<http://github.com/urfave/negroni.HandlerFunc.ServeHTTP|github.com/urfave/negroni.HandlerFunc.ServeHTTP>
/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29
<http://github.com/urfave/negroni.middleware.ServeHTTP|github.com/urfave/negroni.middleware.ServeHTTP>
/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
net/http.HandlerFunc.ServeHTTP
/usr/local/go/src/net/http/server.go:2109
<http://github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1|github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1>
/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:284
net/http.HandlerFunc.ServeHTTP
/usr/local/go/src/net/http/server.go:2109
<http://github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1|github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1>
/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:142
net/http.HandlerFunc.ServeHTTP
/usr/local/go/src/net/http/server.go:2109
<http://github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func1|github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func1>
/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:92
net/http.HandlerFunc.ServeHTTP
/usr/local/go/src/net/http/server.go:2109
<http://github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2|github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2>
/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:104
net/http.HandlerFunc.ServeHTTP
/usr/local/go/src/net/http/server.go:2109
<http://github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerRequestSize.func1|github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerRequestSize.func1>
/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:234
net/http.HandlerFunc.ServeHTTP
/usr/local/go/src/net/http/server.go:2109
<http://github.com/ory/x/prometheusx.Metrics.instrumentHandlerStatusBucket.func1|github.com/ory/x/prometheusx.Metrics.instrumentHandlerStatusBucket.func1>
/go/pkg/mod/github.com/ory/x@v0.0.551/prometheusx/metrics.go:115
net/http.HandlerFunc.ServeHTTP
/usr/local/go/src/net/http/server.go:2109
<http://github.com/ory/x/prometheusx.(*MetricsManager).ServeHTTP|github.com/ory/x/prometheusx.(*MetricsManager).ServeHTTP>
/go/pkg/mod/github.com/ory/x@v0.0.551/prometheusx/middleware.go:41
<http://github.com/urfave/negroni.middleware.ServeHTTP|github.com/urfave/negroni.middleware.ServeHTTP>
/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
<http://github.com/ory/x/metricsx.(*Service).ServeHTTP|github.com/ory/x/metricsx.(*Service).ServeHTTP>
/go/pkg/mod/github.com/ory/x@v0.0.551/metricsx/middleware.go:259
<http://github.com/urfave/negroni.middleware.ServeHTTP|github.com/urfave/negroni.middleware.ServeHTTP>
/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
<http://github.com/ory/kratos/x.HTTPLoaderContextMiddleware.func1|github.com/ory/kratos/x.HTTPLoaderContextMiddleware.func1>
/project/x/httploadermiddleware.go:23
<http://github.com/urfave/negroni.HandlerFunc.ServeHTTP|github.com/urfave/negroni.HandlerFunc.ServeHTTP>
/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 status:Unauthorized status_code:401] http_request=map[headers:map[accept:application/json, text/plain, */* connection:close cookie:[ory_hydra_login_csrf_dev_1258758061=MTY4NjU5ODQzN3xSRGNhQ0Ruc2Z1cDBNbDhueVQ1TFhWSjJXeWlvb3BOSUt5bmE4RnVJc0pIOF9NLUgyRTlDcFkzdHptR1JtM3lwS0hUeEJldHc3bE45S053MmNTSGE2dTgwSTB3WUxVdUZ2Sm81YzR5eDdHbkpGN0pzT2V1cHo1bXQxdkNERWc9PXzcMygTZ9ZkVHc1v75jOdQO9C1TcRE2swo-r7ukny7Jfw==; csrf_token_cdc523be6ce53703e2c61dcec65282dc84d9c5323e86a28b466c961bca11b066=9exMF12lL2EtWJE6Ndgl7sAIbbCzG6hNqnRPfb0IMjo=] user-agent:axios/0.21.4] host:kratos-public method:GET path:/self-service/logout/browser query:<nil> remote:10.0.31.158:45426 scheme:http] http_response=map[status_code:401] service_name=Ory Kratos service_version=v0.13.0
time=2023-06-12T19:33:57Z level=info msg=completed handling request http_request=map[headers:map[accept:application/json, text/plain, */* connection:close cookie:[ory_hydra_login_csrf_dev_1258758061=MTY4NjU5ODQzN3xSRGNhQ0Ruc2Z1cDBNbDhueVQ1TFhWSjJXeWlvb3BOSUt5bmE4RnVJc0pIOF9NLUgyRTlDcFkzdHptR1JtM3lwS0hUeEJldHc3bE45S053MmNTSGE2dTgwSTB3WUxVdUZ2Sm81YzR5eDdHbkpGN0pzT2V1cHo1bXQxdkNERWc9PXzcMygTZ9ZkVHc1v75jOdQO9C1TcRE2swo-r7ukny7Jfw==; csrf_token_cdc523be6ce53703e2c61dcec65282dc84d9c5323e86a28b466c961bca11b066=9exMF12lL2EtWJE6Ndgl7sAIbbCzG6hNqnRPfb0IMjo=] user-agent:axios/0.21.4] host:kratos-public method:GET path:/self-service/logout/browser query:<nil> remote:10.0.31.158:45426 scheme:http] http_response=map[headers:map[cache-control:private, no-cache, no-store, must-revalidate content-type:application/json vary:Origin] size:192 status:401 text_status:Unauthorized took:556.45µs]
curved-ram-6189
06/13/2023, 11:47 AMcurved-ram-6189
06/13/2023, 12:44 PMproud-plumber-24205
06/13/2023, 3:04 PMcurved-ram-6189
06/13/2023, 7:44 PMJoragu:feat/kratos-hydra-integration
. It seems the reference UI doesn't properly propagate the redirect uri:
https://github.com/ory/kratos-selfservice-ui-node/pull/257.
Still trying to figure out if redirecting to the consent screen is correct behavior, since there are no buttons or anything on the screen to accept consent and proceed to the redirect-uricurved-ram-6189
06/14/2023, 1:26 PMkratos-selfservice-ui-node
this morning, rebuilt, fixed the issue with the helm chart and it works! I can get a token!curved-ram-6189
06/14/2023, 1:26 PMadorable-scooter-1570
06/14/2023, 5:52 PMdelightful-noon-48365
06/15/2023, 8:39 AMcurved-ram-6189
06/15/2023, 2:39 PM