Hello, got small question about react-native SDK a...
# support-questions-legacy
a
Hello, got small question about react-native SDK and local development... Is it possible to have different SuperTokens.Init axios/fetch interceptors to allow working with 2 separate API servers?One on the actual live server API (almost all the calls), and one for the local development server I spin up to develop new endpoints (just a few calls)... I tried doing it by calling the init function again and adding interceptors on a separated axios.create instance, but it just uses the original values supplied in the initial call.
n
Hi @addictedllama At the moment the SuperTokens class uses the singleton pattern so additional calls to init will be ignored, and while you could add interceptors to different axios instances theyll end up using the same SuperTokens config because of the singleton pattern as well. What is the exact use case you are trying to achieve? Do you just want to share cookies with the production and local server during development? (I assume because certain APIs are not on production but need to be tested with the same user?)
a
Basically I'm doing 2 migrations at once - one from auth0 to our own hosted supertokens (which went better than expected), but the other one is a migration of our backend data structure, which involves a lot of new endpoint development. I just want to be able to easily call my local development instance for very specific endpoints I'm working on, while still talking with the live API server for the rest
But I guess I'll just grab the token from the async storage and add it the the header myself, since the refresh token handlers is less of an issue in this case
n
Yeah there are other ways but it would require setup and you would need to undo them after you move the local APIs to production anyway
The manual way would probably be easier and less time consuming
a
Yea I suspected as such from looking at your github šŸ™‚
n
Alright, let us know if you need any help with this as you go
a
Thanks anyway, really enjoying the development with supertokens so far (even got it up hosted on a serverless environment which is great for us)
n
Thanks! Do let us know if you have any feedback, we are always looking to improve
c
Well; that's a sorta legit use-case for my feedbacks here : https://github.com/supertokens/supertokens-node/issues/526 šŸ˜‰
2 Views