hi, I am trying to use sdk to integrate the recove...
# talk-kratos
t
hi, I am trying to use sdk to integrate the recovery flow. Login, Register and Setting flows are already working. The problem I have is when the recovery flow sends the email and I click it, I do get redirected to the settings page, however, privileged session is not set and I get a 401 error. Can someone please help
@magnificent-energy-493
@swift-chef-97535
@wonderful-lamp-2357
m
Hey Kakha, can you provide some additional information - I have no idea about your setup right now. How are you running Ory Kratos? Are you using Ory Cloud or selfhosted Kratos? Can you share your configuration? Can you share the error you get, maybe it is just an error in your frontend? What frontend UI are you using? What language/SKD?
t
self-hosted kratos.
Here is config
version: v0.7.1-alpha.1 dsn: memory serve: public: base_url: http://127.0.0.1:4433/ cors: enabled: true allowed_origins: - http://localhost:4455 - http://localhost:3000 - http://127.0.0.1:3000 allowed_methods: - POST - GET - PUT - PATCH - DELETE allowed_headers: - Authorization - Cookie - Content-Type exposed_headers: - Content-Type - Set-Cookie allow_credentials: true admin: base_url: http://127.0.0.1:4434/ selfservice: default_browser_return_url: http://127.0.0.1:4455/ allowed_return_urls: - http://127.0.0.1:4455 methods: password: enabled: true config: haveibeenpwned_enabled: false min_password_length: 8 identifier_similarity_check_enabled: true profile: enabled: false link: enabled: true config: lifespan: 15m flows: error: ui_url: http://127.0.0.1:3000/error settings: ui_url: http://127.0.0.1:3000/dashboard/changePassword privileged_session_max_age: 15m recovery: enabled: true lifespan: 15m ui_url: http://127.0.0.1:3000/auth/recovery verification: enabled: true ui_url: http://127.0.0.1:3000/auth/verification after: default_browser_return_url: http://127.0.0.1:3000/ logout: after: default_browser_return_url: http://127.0.0.1:3000/auth/login login: ui_url: http://127.0.0.1:3000/auth/login lifespan: 10m # after: # password: # hooks: _# - hook: require_verified_address_ registration: lifespan: 10m ui_url: http://127.0.0.1:3000/onboarding/registration after: password: hooks: - hook: session log: level: debug format: text leak_sensitive_values: true secrets: cookie: - ??/= cipher: - ?? ciphers: algorithm: xchacha20-poly1305 hashers: algorithm: bcrypt bcrypt: cost: 8 identity: default_schema_id: default schemas: - id: default url: file:///etc/config/kratos/identity.schema.json courier: smtp: connection_uri: smtps://test:test@mailslurper:1025/?skip_ssl_verify=true session: cookie: name: "sid"
here is the error
I am useing kratos SDK with next js
Recovery flow succesfully sends the email
when I follow the email, privileged session is not set fot the settings flow
m
Hm hard to say what is the problem, the config looks alright, I could not reproduce the error with a clean quickstart & nodejs UI. See the troubleshooting: https://www.ory.sh/docs/kratos/debug/troubleshooting and cookie pitfall docs https://www.ory.sh/docs/kratos/debug/csrf hopefully something is in there that can help you. if that does not help I would recommend you create a reproducible repo and share it on github, then we reproduce what you are facing directly.
t
I've spent a lot of time on cookie pitfalls, thats exactly how I figured out the other error. SDK had a problem setting a cookie on setting page. this feels somewhat similar, feels like things are out of my control
Hopefully you can reproduce the problm with this repo
I am all out of ideas
m
Can you try it out with a developer project on Ory Cloud? It should work interchangeably. I will see to check out the repo you shared this week.
t
I can't make a decision on behalf of the copany to suddenly start using cloud service
m
No i mean not to use it, but just to try out if the error is on the Ory or interface side. You are free to use in production what suits you of course. Basically as a reference Ory Kratos deploy.
t
OKay, so the cloud is a better alternative? Without errors? I just thought Cloud hosted and self-hosted kratos were pretty much the same
m
Yea it is the same underlying Ory Kratos service that is used. But it could help to use Ory Cloud to narrow down where the error comes from. I suspect it is somewhere in your frontend code, and I will see to check out your repo today.
t
Thank you, really need help with this and I appreciate your time
Hello, did you find anything by any chance?
@magnificent-energy-493
s
@thousands-holiday-39862 would you mind telling us more about your company, including the name and details? We can probably put a package together for you in Ory Cloud. You have already used a lot of time in this support channel, and we need you to move to a commercial package in order to support you from Ory. There may be others in the community that can provide the type of support you need too.
t
I am waiting for Vincent's answer, he promised me he would look into it. This is the one last thing I have to do, and I am basically done with kratos. My company has decided beforehand they wanted a seelf-hosted kratos, so I cant make them change it
m
Hey @thousands-holiday-39862 I tried to pinpoint the error in the repo you shared, but I am not sure what causes the recovery flow to error on your end. I had some trouble to reproduce it as well… I think at this point you have several options: a) have a thorough look again at the kratos-selfservice-node (bc it works there) b) open a bug report in /kratos & share a repo with your frontend code, kratos.yaml, and a numbered list of steps to reproduce the error c) look into using the managed Ory service, it is functionally the same but you can just use it. Themed hosted UI is available very soon. I understand that this is frustrating but please also understand that we have limited bandwidth to debug 🙏 .