Search code examples
pythongoogle-app-engineoauthdatastorefoursquare

Connecting methods Python


I am currently using Oauth to allow a user to sign in through Foursquare, I then create a new session for this user. If the user is new to the system they are asked to sign in through Hunch, this can then generate a user profile based on information from both systems. I have them both signing in to each application separately, but how can I associate the user logged in with Foursquare to the one in Hunch. My idea for it was to somehow create a reference to the session id in the user model, or use the session ID as a parameter for the hunch sign in but I'm not sure if this would be the best idea. Is there any other way in which I can create the association?


Solution

  • The easiest way to do this would be something like the following:

    1. Send the user to foursquare to sign in
    2. When the user returns, create a record in the datastore for them.
    3. Send the user to Hunch to sign in, but include the ID of the record you created in step 2 in the continue URL.
    4. When the user returns, use the ID embedded in the URL to add the user's Hunch info to their user record.