How to integrate Memberstack authentication with React Native using Vercel backend without getting Missing Authentication errors?

Post author
Ryan Esling

Absolutely losing my mind right now - essentially trying to hook up Memberstack as my login for my react native application. Yes yes I know, memberstack is not natively built for anything outside of web applications, but I use webflow for all my companies and thus, I want to use it for our official IOS App aswell. Issue is, I keep getting this draining "Missing Authentication" Error.

    const response = await axios.post(
      'https://api.memberstack.com/v2/members/login',
      { email, password },
      {
        headers: {
          'X-API-Key': process.env.MEMBERSTACK_SECRET_KEY, // Use API key from .env
          'Content-Type': 'application/json',

im running a backend vercel deployment to run the Memberstack API with the intention of verifying their email/password, thus logging them into the application. Is this even possible with the current functionalities of the Memberstack API? I know the admin api does a little short of this as it doesn't provide the password for security reasons. I really don't want to switch off from Memberstack for our app. This will be our first app that uses the Memberstack Stripe system aswell, so we're super excited.

Any help would really be appreciated. Will provide all code as needed 😞

Comments

7 comments

  • Comment author
    Tyler Bell

    Hey Ryan,

    https://api.memberstack.com/v2/members/login is not a valid endpoint. The admin API doesn't have any sort of login route.

    Take this with a grain of salt because I'm not super familiar with native apps, but I think you're best chance will be implementing a web view for login.

    If you're able to do that, you can login the member like it was any other website (via the webview), get the token, and then later use that token to identify the user.

    The admin API (and NPM package) does have an endpoint / method used to verify member tokens.

    Unfortunately that's really the best advice I have. Native apps is a space we know nothing about.

    Here are the docs for verifying a member token via the admin APIhttps://developers.memberstack.com/admin-rest-api/verification

    here's another possibility....you could reverse engineer the login route that is used by our webflow package.
    This would be totally off the books but technically it could work...
    For that here's what I'd do...
    • go to your webflow site
    • open up the inspector / network tab
    • login a member
    • look at the login request that was made
    • mock that in your backend
    the more I think about it, that should actually work for you
    and would be way easier than dealing with a web view
    0
  • Comment author
    Ryan Esling

    Thanks Tyler!

    Im open to anything, im ripping my hair out right now.

    Ill try my best - I will report back with the results.

    0
  • Comment author
    Tyler Bell

    POST  https://client.memberstack.com/auth/login

    //send in body
    {
        "email": "tyler@memberstack.com",
        "password": "password",
        "options": {
            "includeContentGroups": true,
            "isWebflow": true
        }
    } 
    

    headers you would want to include

    content-type: application/json
    x-app-id: your-app-id
    referer: https://ms2-starter.webflow.io/ -replace with your domain so MS knows to use live or test mode
    
    0
  • Comment author
    Tyler Bell

    ah actually do this...

    content-type: application/json
    x-api-key: your-public-key
    

    make sure to put your public key there. Not the secret key

    0
  • Comment author
    Ryan Esling

    once I get the login response with the token, what would be the recommended approach to store and pass the token in my app to authenticate further requests? Should I store it in AsyncStorage or some other secure way?

    somebody get this Tyler Bell a promotion to president of the co founders
    0
  • Comment author
    u naum

    Tyler Bell what about the sign in with google or linkedin ?

    webview is the only option i think if we want all these options! right?

    0
  • Comment author
    Felix Gräf

    Hi Memberstack team,

    I’m building a React Native app. I’d like to authenticate users via Memberstack, but the official SDK (@memberstack/dom) is browser-only.

    • Is there a supported way (REST endpoint, admin API, JWT flow, etc.) to log a user in from a pure React Native environment?
    • If not, is there a roadmap or recommended workaround (e.g., using a webview, custom token exchange, or the new “/clients/auth” beta route)?

    I couldn’t find any login / session endpoints in the REST or admin packages. I tried everything I could. The above approach only works for members that logged in through the normal email flow. But social log in doesn’t work unfortunately (Google and LinkedIn)

    Any guidance or docs you can share would be greatly appreciated.

    Thanks!

    0

Please sign in to leave a comment.