Is it possible to retrieve a session via a proxy with create-react-app ? via /r/learnprogramming


Is it possible to retrieve a session via a proxy with create-react-app ?

So create-react-app allows users to specify proxies for api endpoints or whatever.

I have created an endpoint http://localhost:1555/auth/login that will login in a user if their credentials are correct and set a session for them. The app will then redirect them back to the create-react-app account page I have set up. (Keep in mind this CRA so it's in localhost:3000). This API endpoint is using the Java Spring framework.

So in my create-react-app project, I simply proxy the url I made inside the package.json and I have a nice form that will post to that Java spring endpoint…but my session does not get set because…why ? Is it because they are in different ports ? Do I need to set some headers in my post ? Is the redirect causing problems ? The sessions are set but only on the api endpoint localhost:1555, not localhost:3000. Since I am using Spring, I get a jsessionid on my cookies, could I use that somehow when I make another api request ? If you need more info ask, any help or direction would be appreciated.

Submitted July 12, 2017 at 10:11PM by HappyZombies
via reddit http://ift.tt/2t5QwKV

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s