Results 1 to 3 of 3

Thread: Not able to redirect using Flask

  1. #1
    Join Date
    Nov 2017

    Not able to redirect using Flask

    Hello All,

    I am doing a project in which 2 websites are involved site A and site B.
    When user opens the site A he will be asked to enter his credentials, on submitting, site A will send the credentials to site B which will authenticate the user and on successful authentication will supply a sessionId and a UniqueUserID in a cookie. I have to grab this cookie and redirect the user to user to the site B, where he will be already logged in.

    I tried, using Flask I was able to achieve the first part, but the part where I have to inject the cookie in to the browser of the user and redirect to the website, I was not able to do that.

    @app.route('/postmethod', methods = ['POST'])
    def get_post_javascript_data():
        return redirect("https://xxx.com/monitoring_center", code=302)
    Not sure whether this is achievable or there is any other language that is more capable\easier in handling this kind of manipulation.
    I used Flask because I am familiar with Python, if there is any other language please suggest, I will try to learn and try with that as well, and if someone can help with the above issue that will be great .


  2. #2
    Join Date
    Aug 2004
    I am by no means an expert on this, but I think you'll run into trouble with trying to send a cookie from one site to another. It may in theory be possible, but will likely be dependent on the user's browser security/privacy settings, as you'd then be dealing with 3rd-party cookies. Outside of using something like OAuth, maybe a one-time token in the request which the second server would then use to set its session cookie?
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Oct 2013
    Sheboygan, Wisconsin
    3rd-party cookies
    So many times those are blocked.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center