/    Sign up×
Community /Pin to ProfileBookmark

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.

[CODE]@app.route(‘/postmethod’, methods = [‘POST’])
def get_post_javascript_data():
loginCall()
return redirect(“https://xxx.com/monitoring_center”, code=302)[/CODE]

Not sure whether this is achievable or there is any other language that is more capableeasier 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 ? .

Thanks

to post a comment

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogNov 07.2017 — 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?
Copy linkTweet thisAlerts:
@TrainNov 07.2017 — 3rd-party cookies[/QUOTE]

So many times those are blocked.
×

Success!

Help @jardhe spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...