Hello! I've implemented in POC login/registration ...
# ory-network
w
Hello! I've implemented in POC login/registration flow using static React app and your client library. It's easy and well described how to do it with login/password using
submitSelfServiceRegistrationFlow
. But my main question is.... If in the same form can I have a "Login by google" button to use oAuth? And if yes how can I trigger that flow (on custom onClick event) somehow using
@ory/client
? I see it's working only when I use
@ory/elements
(from your example) and don't know how to implement it in my custom solution. I would be very grateful for your answer 🙏
h
Hi @white-judge-93493 it’s definitely possible using only the SDK but of course much easier when using Ory Elements. Maybe you could expand a bit why Ory elements doesn’t work for your use case? @proud-plumber-24205 will be happy to pick it up 🙂
w
So can I find somewhere information how to do it? :)
Maybe you could expand a bit why Ory elements doesn’t work for your use case
I want to have custom UI for that
s
you can take a look at the Ory elements code, that should help https://github.com/ory/elements
p
Hi @white-judge-93493 Yes you can include oidc / passwordless and password inside the same form. I would recommend to separate these into different html forms so that users pressing the Enter key when submitting the password form does not trigger a submit on a higher priority button e.g. oidc "login with google". Could you explain which parts you are struggling with? Please check out this component for a better understanding of how we do it. https://github.com/ory/elements/blob/main/src/react-components/ory/user-auth-card.tsx Essentially the component uses: 1. filter out the nodes by group and attribute (retrieved by the sdk as the "flow" data) using
FilterFlowNodes
2. render each "section" inside the card, a section can be "login oidc" or "login password" e.g.
LoginSection
3. render any top level error messages using
NodeMessages
You could always use these components directly from Ory Elements to construct your custom UI. this will save you a lot of time 🙂
w
Thanks, that helps 🙂
do you know maybe also why i get 502 as response when call password/login registration with
.submitSelfServiceRegistrationFlow(flow.id, body)
using
UserAuthCard
p
Hey @white-judge-93493 Can you show me where you are handling the
onSubmit
? and which data are you passing back? Could you show the response message?
m
p
Hi @many-microphone-43631 I've been in private chat with @white-judge-93493 I haven't been able to pin down the cause yet and I haven't been able to reproduce the issue. Are you using the latest
@ory/client
? Also are you seeing the same error when running the React example using Ory Elements with your project? https://www.ory.sh/docs/getting-started/custom-ui-ory-elements Which version of the Ory CLI are you using? Is it up to date?
m
I'm getting the same error while using ui provided by ory
so I don't think it's related to our code
p
So the Ory Account Experience UI gives the same error? Could you DM me the link?
m
yeah sure