Hi guys! Fix me if I am wrong, but it seems current super-tokens react native sdk is not support soc...
k
Hi guys! Fix me if I am wrong, but it seems current super-tokens react native sdk is not support social sign-ins? I.e I mean call function to open browser, where user put his credentials and receive a callback with user information? Docs says it supports only session management.
r
hey @kolayuk
we do support social sign in with react native. Have a look at this example app: https://github.com/supertokens/supertokens-react-native/tree/master/examples/with-thirdpartyemailpassword It shows buttons for sign in with google / apple etc.. and when a user clicks on it, it starts the login flow with the providers which yields an access token on app. This is then sent to supertokens via an API call which creates the user in supertokens and also creates their session.
@kolayuk
d
Hey @rp_st I am having trouble with the getUserId method and getting axios network errors when I use my own functions for login and logout
This is for native app but simulator they work
r
Hey. @nkshah2 can help here.
n
Hey @Deleted User, Can you share the code you are using and the error you get?
d
Axios Network Error when it runs on native
I’ll have to get you the code tomorrow
Copy code
export const getSession = () => {
  return async (dispatch) => {
    try {
      if (await SuperTokens.doesSessionExist()) {
        const userId = await SuperTokens.getUserId();
        const response = await axios.get(
          `${REACT_APP_API_DOMAIN}/users/${userId}`
        );
        const payload = response.data;
        dispatch({
          type: GET_SESSION,
          payload: payload,
        });
        await setItem("uSession", payload);
        return payload;
      } else return null;
    } catch (e) {
      const session = await getItem("uSession");
      if (session) {
        dispatch({
          type: GET_SESSION,
          payload: session,
        });
        return session;
      } else throw e;
    }
  };
};
I ran console.log(await SuperTokens.getUserId()); and it isn't returning anything
n
and doesSessionExist returns true correct?
d
correct
i dont think it is the problem
n
What OS are you testing your app?