Hey, I am using the Descope React component, with ...
# ask-a-descoper
m
Hey, I am using the Descope React component, with SSO. When the user is successful, the page is redirected back to the login page, where the client renders and handles the code that was returned / cookies / remember me. If I set the redirectUrl in the component, I need to do all of the above myself (am I correct?). Is there any way to use the Descope react component in such a way that it does not redirect back to the login page with the flow embedded, but still have the above handled for me?
c
If you change the redirect URL, you will need to either host a flow, or handle the code returned yourself and complete the authentication, and direct into your authenticated pages. You could redirect to a different page, and host a flow, but that seems to be about the same as your current implementation, so if you don't want to redirect to a flow, you will need to capture the code and complete the authentication. For exchanging the SSO code in react https://docs.descope.com/auth-methods/sso/with-sdks/client#sso-exchange-code
m
Thank you! I don't want to redirect to a page that renders a client, I want to redirect to a server route that does the validation and redirects to the correct url in our app once authenticated. Is there any way to do that, but still get the out of the box capabilities from descope for setting the cookies and the remember me data in the local storage?
c
I don't think so, if you use the backend to validate it, it'd need to call your client to set the cookies and everything. @Kevin Gao @Asaf Shen correct me if I'm wrong here?
m
I could not find one, is there an sdk call that I can make to set the remember me local storage properly? The storage name is not exposed from the sdk and it seems wrong to hard code the format and the name of the storage for descope local use
k
It sounds like you just want to add SSO without actually using a flow at all, and just manage the exchange yourself is that correct?
m
Not really. I want to have the flow, without having to come back to the ui. Does RelayState work to set a URL to come back to after the sso is successful, when using a self hosted flow? Is there an api to set the local storage for remember me?
a
We have a new customStorage prop , i think it will be possible to implement that with that prop
m
Great! Can I please get documentation / instructions?
c
@Anvi Banga @Kevin Gao can you help direct to docs on this one?
a
I think that for now it’s in the sdk readme
m
Can you please send me a link? I did not see it
a
sorry, docs are not ready yet I can only suggest the PR - https://github.com/descope/descope-js/pull/1219/files