Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 891653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:55:26+00:00 2026-05-15T13:55:26+00:00

I am writing a Python/Django web application that uses OAuth (for the TwitterAPI, not

  • 0

I am writing a Python/Django web application that uses OAuth (for the TwitterAPI, not that it should matter).

I am storing a session ID in my login function, and then after using OAuth to get the user’s token, I try to retrieve the sessionID in my callback function. The callback function then always fails(throws an exception) because it can’t find the OAuth token in the session. Through the debugger, I am able to determine that the session ID that the server is using is incorrect – it does not match the session ID that was stored in the login function. It’s therefore unsurprising that the Oauth tokens were not there. The session that appears in the callback was the same one each time (until I tried deleting it – see “things I’ve tried below”), and it started out as an old session, with some data in it that is from a different django app running on the same server that I hadn’t touched in a couple weeks.

Here’s the kicker: everything I described is an issue only on our production server, and only when connecting to it from my computer. Let me clarify: this only happens with my particular laptop. I can connect to the app just fine from someone else’s computer. Other people cannot connect with their accounts on my computer. Furthmore, I can connect just fine to the app when it is running on my localhost using the built-in django webserver, just not to the production server.

My setup: my server and local box are running= Django 1.2.0 and Python 2.6.5. My local box is running Snow Leopard and the Django webserver, the server is running Ubuntu, Apache2, and mod-wsgi. For sessions, I am using Django’s default session backend (DB).

Things I have tried, all to no avail:

  • logging in with a different account, including new accounts that have never OAuthed to this app before
  • Clearing cookies, using incognito mode, using a different web browser on my same computer. Each time, upon inspecting my cookies, the sessionID matched the sessionID in the login function and was different from the sessionID in the callback.
  • deleting the session in the database that appears in the callback function, (the one that appeared to be old data). The callback function still fails, and the sessionID it appears to be using is now a new one
  • using a different session backend (DB-cache, flat file, etc…)
  • restarting the server, my computer, etc.

    My first question on StackOverflow, so bear with me if I didn’t quite follow local conventions. I am just at a loss as to what to even look for – what are the things that could possibly be causing sessions to not work on my particular computer, and (so far!) only my particular computer?

    EDIT: solved it, a few hours after posting this question, after struggling with this for a couple days!

    The problem had nothing to do with my computer, and was caused by the person typing on it! Subconsciously, I was typing “www.our-domain.com”, and all of my coworkers have been typing “our-domain.com” the entire time. We didn’t have Apache rewrite rules in place, so at login, the session ID was being set in a cookie with the “www.” as part of the domain, but the redirect for the callback function had an associated url without the “www.”, so my browser was using two different cookies, which I somehow didn’t see until now (because the way I was searching for cookies also included the www!). Very simple, and should have thought of it earlier. Moral of the story: be careful about subdomains with your sessions.

    • 1 1 Answer
    • 0 Views
    • 0 Followers
    • 0
    Share
    • Facebook
    • Report

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    1 Answer

    • Voted
    • Oldest
    • Recent
    • Random
    1. Editorial Team
      Editorial Team
      2026-05-15T13:55:26+00:00Added an answer on May 15, 2026 at 1:55 pm

      Solved it, a few hours after posting this question, after struggling with this for a couple days!

      The problem had nothing to do with my computer, and was caused by the person typing on it! Subconsciously, I was typing “www.our-domain.com”, and all of my coworkers have been typing “our-domain.com” the entire time. We didn’t have Apache rewrite rules in place, so at login, the session ID was being set in a cookie with the “www.” as part of the domain, but the redirect for the callback function had an associated url without the “www.”, so my browser was using two different cookies, which I somehow didn’t see until now (because the way I was searching for cookies also included the www!). Very simple, and should have thought of it earlier. Moral of the story: be careful about subdomains with your sessions.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Ask A Question

    Stats

    • Questions 491k
    • Answers 491k
    • Best Answers 0
    • User 1
    • Popular
    • Answers
    • Editorial Team

      How to approach applying for a job at a company ...

      • 7 Answers
    • Editorial Team

      What is a programmer’s life like?

      • 5 Answers
    • Editorial Team

      How to handle personal stress caused by utterly incompetent and ...

      • 5 Answers
    • Editorial Team
      Editorial Team added an answer I found it (thanks Hoogle), it's called intercalate. May 16, 2026 at 10:14 am
    • Editorial Team
      Editorial Team added an answer Yes, use glPointParameter with the GL_POINT_DISTANCE_ATTENUATION parameter. http://www.khronos.org/opengles/sdk/1.1/docs/man/glPointParameter.xml It's quite… May 16, 2026 at 10:14 am
    • Editorial Team
      Editorial Team added an answer There is no definite answer to that. Clients differ. Some… May 16, 2026 at 10:14 am

    Trending Tags

    analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

    Top Members

    Related Questions

    I have started learning Python by writing a small application using Python 3.1 and
    I'm tasked with writing an application that acts as a central storage point for
    When writing web apps in Python, it's brain dead easy to run a development
    I've pretty much tried every Python web framework that exists, and it took me
    I am writing a django application and there is something I don't know how
    I am writing python, javascript, html and other config files and I realize that
    I am developing a Math application which can be extended by writing python scripts.
    I'm writing a database application where certain parts of the database might need updates
    I'm writing a simple Python parser, where I loop over each line in a
    I'm writing a script to generate a CSR in Python. The script is very

    Explore

    • Home
    • Add group
    • Groups page
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help
    • SEARCH

    Footer

    © 2021 The Archive Base. All Rights Reserved
    With Love by The Archive Base

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.