D
D
Dmitry Snytkin2018-10-29 19:43:29
JavaScript
Dmitry Snytkin, 2018-10-29 19:43:29

Why does not log in to the ios version through cookies?

Hello. I'm trying to login to a site (phpbb forum) from an application. To do this, I send a request

let formData = new FormData();
          formData.append("sid", sid);
          formData.append("username", user);
          formData.append("password", password);
          formData.append("redirect", redirect);
          formData.append("autologin", 'on');
          formData.append("login", login);
          console.log("SID", sid);
          return fetch(`${baseUrl}/forum/phpBB3/ucp.php?mode=login`, {
            method: 'POST',
            body: formData,
            credentials: 'same-origin'
          })

Logs in successfully, because. cookie comes (if you enter the wrong login and password, then the cookie does not come). Next, I'm trying to make a request to get information about the user
fetch(`${baseUrl}/forum/phpBB3/ucp.php?i=ucp_profile&mode=reg_details&sid=${this.sid}`, {
      method: 'GET',
      credentials: 'same-origin'
    })

And here is the most interesting thing: on the Android version of the application, I get the correct page of the authorized user. On ios build I get an unauthorized page. I sin on working with cookies. This is the question - why does not work in ios.
Tried
- change credential to omit, include
- take cookie from set-cookie after login, transform and give in cookie header of second request
- axios with withCredentials
doesn't help
React Native 0.55.4
Expo v29

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nick, 2018-10-30
@DragonSpirit

I propose to go through a sniffer (the same charles) or compare the requests that go with ios and android, at the same time look at the differences in cookies. As an option, you can check requests through the react native debugger, how to connect to expo is described in this article

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question