Hi I've followed this <guide> to get google auth t...
# ask-a-descoper
c
Hi I've followed this guide to get google auth to appear as dopt and that works great. however when calling
oauth.exchange()
via the react-sdk the function does not work in prod when we have the the tokens managed by cookies because the cookies are set via a domain that isn't ours. Are we supposed to wrap the oauth exchange function in our backend and pass the cookies back? also if we wrap the request will this just work with the react sdk's session management? i'm assuming no because y'all can't set cookies so there is no way for you to refresh the DS cookie
s
Hey Carlos, have you requested us to setup your cname yet? If not, what do you want it to be and I'll have the team add it. This guide covers the configuration of the managing of refresh token in cookies. https://docs.descope.com/tutorials/cnameguide/
c
yes! we have the cname setup already but the url still says api.descope.com is there another setup I need to do?
s
Did you request it with us? Sorry if I missed it, just want to ensure that you had us do the step we need to do. If it was set up, did you set the host DNS to be
<http://auth.dopt.com|auth.dopt.com>
?
c
yes we do! its to auth.app.dopt.com!
s
Cool yea. Looks good on ping. Within the Descope console, you have
<http://app.dopt.com|app.dopt.com>
correct? https://docs.descope.com/tutorials/cnameguide/#configure-descope-project Then from there, within your code when you initialize the sdk, do you have the baseURL configured?
Copy code
<AuthProvider projectId='__ProjectID__' baseUrl='<https://auth.app.dopt.com>'>
https://docs.descope.com/tutorials/cnameguide/#update-the-base-url-within-your-code
c
ohhh interesting
and that auth.app.dopt.com doesn't really exist in our repo
is that okay?
the only thing it does is redirect to y'all
we don't have the baseurl set!
s
Right, it's routed via your DNS record. Ex of pinging yours and mine:
Copy code
āžœ  descope-html-sample-app git:(main) āœ— ping <http://auth.app.dopt.com|auth.app.dopt.com>
PING <http://cname.descope.com|cname.descope.com> (104.18.26.223): 56 data bytes
64 bytes from 104.18.26.223: icmp_seq=0 ttl=57 time=10.161 ms
^C
--- <http://cname.descope.com|cname.descope.com> ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 10.161/10.161/10.161/0.000 ms
āžœ  descope-html-sample-app git:(main) āœ— ping auth.chris4490.tech
PING <http://cname.descope.com|cname.descope.com> (104.18.26.223): 56 data bytes
64 bytes from 104.18.26.223: icmp_seq=0 ttl=57 time=11.624 ms
^C
--- <http://cname.descope.com|cname.descope.com> ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 11.624/11.624/11.624/nan ms
Once you set the baseURL you should be good to go
c
amazing! i'll try it rn
s
Let me know if you have any issues, we can hop into a zoom
c
thank you! it will be a little slow because i gotta make a pr and deploy! i'll ping you if anything comes up
s
All good!
c
Hi okay i've been testing this all and I have a problem the backend that validates our session tokens is
<http://gateway.dopt.com|gateway.dopt.com>
however it isn't being sent the cookies because our DSR cookies are under the domain
.<http://auth.app.dopt.com|auth.app.dopt.com>
because it isn't a subdomain or direct parent domain of
.<http://auth.app.dopt.com|auth.app.dopt.com>
it isn't being sent the cookies.
can i get the domain of the DSR cookie as `.dopt.com`without changing my cname?
I guess one solution could be to change the cname to auth.gateway.dopt.com but this would break a lot of stuff in production...
šŸ™ŒšŸ¼ 1
I think this will work! its exactly what I wanted! update: it did birthday party parrot
s
So you're good to go @colossal-appointment-48082? Or we need to update to dopt.com? @orange-belgium-27264 FYI in case we need to update it.
c
I think all i needed to do was update the custom domain because everything still seems to work fine? I also added a new cname but I don't think it was actually needed?? as i'm still using the old one in my social auths and baseUrl and its returning me a cookie with the correct domain (
.<http://dopt.com|dopt.com>
)
s
Cool. Everything is now working as expected?
c
still testing locally but yes! i'll try production next week!
s
Keep us posted
šŸ‘ 1
@colossal-appointment-48082 which version of the node sdk are you currently using?
c
I'm using version 1.5.2!
s
If you monitor the network log, do you see an excessive amount of refresh and me calls? If so, I’d recommend updating your sdk version within your app. I believe we fixed that in 1.5.3
c
oh my gosh yeah thats so nice to know
yeah we have a few too many
and I assumed I was doing something wrong in my useEffect hooks
I'll make note to update next week I'm not trying to push out anything towards EOD on a Friday
s
Totally understood. Just let us know
c
thanks for the heads up!
šŸ‘ 1