Hello everyone, I'm currently reworking React Sup...
# support-questions
b
Hello everyone, I'm currently reworking React Supertokens
auth
pages implementing custom design and pages that use APIs directly with
axios
, I'm having issue with
sIRFrontend
cookie, when its valued changed to remove it will never change even if i have successful
login / register
, however if I use
fetch
everything works just fine.
n
Hi @Bruno Diferente,
Are you adding the SuperTokens interceptor to your axios instance?
b
Hello @nkshah2, How are you doing ?
No not really
n
What recipe are you using?
b
Email and password, but my fellow added thirdparty login without changing the recipe 😄
b
Ah it is indeed
Thirdpartyemailpassword
import EmailPasswordReact from "supertokens-auth-react/recipe/thirdpartyemailpassword";
He just kept the same name
b
Alrighty will check it
I think It is working all fine Thanks bro, Is there a possibility to refactor thirdpaty login / register part so just making custom buttons and call same apis....
n
Yep the recipe exposes all the functions so you can call them manually and handle everything yourself
b
Well for me I didn't use the exposed functions
I have just called the same endpoint
to test it
So i wanted to make new
functions
that behave in same way
n
So if you use SDK version
0.22.0
or above you could just do something similar to
ThirdPartyEmailPassword.thirdPartySignInAndUp
And that would handle calling the API for you
b
reason why: my backend sends extra information so i have to catch it as well
n
That way you wouldnt need to do it manually
You can use the preApiHook and postApiHook features to add and consume additional information too
b
preApiHook
&
postApiHook
!
n
Yep! that way you can leave making the call to the SDK and just handle the part that is custom to you
But if you absolutely need to do the API calls yourself, in that case its best to create the auth form yourself too
b
Exactly that's what I'm doing
Custom page, custom design and just using API's
Is it mandatory to keep config file like that
n
Im not sure what you mean
b
I mean after refactoring all pages and implementing custom pages, will this config file and library implementation still be mandatory
n
So you have a few options: - If you want to either use the pre-built UI or the helper functions we provide you can use the
supertokens-auth-react
SDK in which case yes you would need that config - If you want to handle everything yourself and just have SuperTokens manage cookies and session management for you, you should use the
supertokens-website
SDK which has a minimal config
b
Supertoken would still exist in the backend
n
The website SDK does not have any of the recipes other than Session so you would have to refactor quite a bit
But yes it is possible to have just the bare minimum
b
Gotta keep it as i need the auth wrapper
n
Yes in that case you would need to keep the config
b
Alrighty
Thank you
n
Happy to help!
b
Much appreciated