Experience with GAE sessions vanishing following a POST request initiated by JavaScript

Currently, I am working with a GAE application that utilizes a session for storing information. Alongside this, there is an Android app in place which interacts with the GAE by sending requests and subsequently using the session when receiving responses. Presently, I am attempting to create a JavaScript client that mimics the functionality of the Android app. This JavaScript client uses XMLHttpRequest to send Ajax requests (with CORS enabled) to the GAE application. Interestingly, while the first request executes without any issues, the second request encounters a NullPointerException when attempting to access an object stored in the session.

It's worth noting that both of these requests originate from the same page - one upon loading the page and another triggered by a user clicking a button.

Would anyone happen to have insights into what might be causing this issue?

Answer №1

One issue encountered was due to a cross-domain Ajax request causing the session ID cookie not being saved. The solution involved setting withCredentials to true in the request, specifically in Chrome. This also required ensuring that no wildcard was permitted for Access-Control on the server side, and Access-Control needed to allow credentials.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I am unable to display the answer buttons and organize them accordingly within my project

I'm currently working on a quiz project where I fetch an API containing quiz questions and answers. The API provides an array of wrong answers (3) along with one correct answer. My goal is to display these options as buttons, so I decided to push the ...

Is there a method to manually generate a cookie for Internet Explorer using InnoSetup?

Is there a way to manually create a cookie in InnoSetup on behalf of a specific website, such as www.stackoverflow.com, similar to how JavaScript cookies are stored? Javascript cookie: function setCookie(cname,cvalue,exdays) { var d = new Date(); d.s ...

What is the best approach for retrieving data from an external URL?

After implementing this code: $(document).ready(function() { $.ajax({ type: "POST", url: "http://steamcommunity.com/market/priceoverview/?currency=3&appid=730&market_hash_name=StatTrak%E2%84%A2%20P250%20%7C%20Steel%20Disruption%20%28Facto ...

Using Google App Script's pageToken to store attachments on Google Drive

Essentially, my goal is to save all attachments from received emails to a specific folder in Google Drive (mostly .PDF files). However, I've encountered a limitation with the search function which only allows me to retrieve up to 500 attached files. I ...

Ajax functionality is functioning properly in Firefox, however, it is facing issues in

Chrome seems to be having trouble while Firefox is functioning perfectly fine. The data is returning undefined in Chrome even when a simple string is being returned. This issue is happening within Wordpress. $('.vote-synergy-up, .vote-synergy-down&ap ...

Unable to locate a custom definition for TypeScript v3

When I am running my webpack dev server, Typescript is generating this error: ERROR in ./src/components/allowcated-resources/AllowcatedResources.tsx Module not found: Error: Can't resolve 'my-scheduler' in 'mypath\allowcated-resou ...

Fade in the new content with Ajax once it has finished loading completely

Is there a better approach to fading in new content only after it has fully loaded? It seems like the timing of beforeSend and complete functions is not effective. The new content currently fades in even before the slide up animation has completed. I admi ...

Learn how to showcase JSON file contents in HTML using AngularJS

When attempting to display a collection of questions stored in JSON data within an HTML file, I incorporated the ng-repeat directive to loop through the data using ng-repeat="q in response", and then attempted to print them individually like this: {{q.q1} ...

Troubleshooting: Why is my AngularJS Controller not functioning properly

I attempted to run a basic Angular example utilizing a controller, but it does not appear to be functioning correctly. Below is the HTML code: <!DOCTYPE html> <html ng-app = "app"> <head> <title></title> ...

Unexpected error message appearing as 'undefined' instead of successful notification

I am currently in the process of developing a server-side rendered website using Node. My goal is to have a green alert box displayed upon successful data update in updateSettings.js. However, even though the user data (name and email) is successfully upda ...

Guide the user to redirect and guarantee a complete page load or reload every time

Suppose I navigate to the page http://mywebsite.com/contact and execute the following JavaScript code: window.location.assign('http://mywebsite.com/contact#foo'); The page remains static without refreshing, which is intentional. However, I aim ...

Transforming JSON information into a Backbone Model accompanied by a child Collection

Currently, I am dealing with a Playlist object that comes with various properties to define itself, along with a collection of PlaylistItems. Upon receiving data from the server, the JSON response is processed in the client-side success method: success: ...

Transform a REACT js Component into an HTML document

I'm working with a static React component that displays information from a database. My goal is to implement a function that enables users to download the React component as an HTML file when they click on a button. In essence, I want to give users ...

Obtain document via Angular 2

Is it possible to use TypeScript to download an image that is already loaded? <div *ngIf="DisplayAttachmentImage" class="fixed-window-wrapper_dark"> <button class="btn btn-close-window" (wslClick)="HideAttachmentImage()"> & ...

AngularJS: Enhancing User Input Experience with Bidirectional Data Binding for Numeric Inputs

I'm exploring the use of Angular for data-binding with input type="number" elements, but I'm encountering difficulties in getting the binding to work. When I make changes to any value, I expect the corresponding binded value to update as well. J ...

Resolving label overlapping issue in Chart.js version 2

I am currently utilizing Chart.js 2 for a project of mine. I've successfully customized the style, but there's one persistent issue that I can't seem to resolve and it's becoming quite frustrating. Occasionally, the last label on the x ...

Storing and Retrieving Multiple Data with localStorage

I need assistance with modifying my code. I have an input field labeled "mail" and I am trying to store email addresses and corresponding IDs in local storage. The email address should be taken from the "mail" input field while the ID should increment each ...

Challenges in verifying user identities and maintaining session continuity in passport.js/Node.js

Currently, I am in the process of setting up passport for authentication on my node.js web application. However, I am encountering some difficulties with properly storing session data. Right now, it seems like the session data is not being stored at all. ...

Leveraging History.js to save information and subsequently retrieve it for dynamically loading content via ajax requests

Currently, I am in the process of developing a fully ajaxified website. The snippet below showcases the code for loading pages via ajax. I have been attempting to integrate history.js into this code; however, upon implementation, it only alters the URL wit ...

retrieving identifiers from a separate table for an array of values

As a newcomer to node and noSQL databases, I am facing challenges in grasping the concept of passing an array of IDs and retrieving the corresponding values from another table. I have 'users' and 'products' tables in my database. The st ...