Coder Social home page Coder Social logo

Twitter login via OAuth about pybossa HOT 5 CLOSED

scifabric avatar scifabric commented on May 20, 2024
Twitter login via OAuth

from pybossa.

Comments (5)

teleyinex avatar teleyinex commented on May 20, 2024

Have you seen BrowserID from Mozilla? It seems pretty interesting :)

from pybossa.

teleyinex avatar teleyinex commented on May 20, 2024

@rgrp I've a running version of the Twitter OAuth authentication for PyBossa. However I do not like too much my code yet, as everything is in the 'account' blueprint. Any advise to refactor the code properly? I guess that the twitter object should be created in the core.py file, and exported via the flask.g proxy to the blueprint. What do you think?

from pybossa.

teleyinex avatar teleyinex commented on May 20, 2024

@rgrp Maybe it is even better to move everything to utils.py, and import it only when needed. It is more like a helper function than anything else. What do you think?

from pybossa.

teleyinex avatar teleyinex commented on May 20, 2024

@rgrp Now I've a running branch in my laptop that works well with Twitter. It checks if it is the first time that you use Twitter to log in and in that case it asks you to provide an email.

While I was coding I realized that it will be interesting to store the user_id from Twitter in the DB. I've been reading sqlalchemy-migrations and I've a changeset (tested in SQLite and PostgreSQL) that adds an extra column (twitter_user_id) to the User table. The script is stored in the repository pybossa/pybossa/migrations and I was thinking if you like this approach or if you prefer to recreate the DB completely as there are not too many users or projects using PyBossa yet.

Another possible solution is to use the flags and category columns from the User table (these columns are already defined) in the following manner:

  • category: for specifying that the user used Twitter, Facebook or whatever to create the account
  • flags: for storing the user_id associated to the Twitter, Facebook or whatever provided that we will use for authenticate the user.

This last solution is the most simple one, so I would vote for it :) The only problem is that category and flags are Integer columns, so we should use an array to map the categories. Something like: Twitter -> 0, Facebook ->1, Google ->2, etc.

What do you think? In any case learning sqlalchemy-migrate has been very useful :D

from pybossa.

teleyinex avatar teleyinex commented on May 20, 2024

Hi again :D After reading your post about sqlalchemy I'm now more confident that we should use SQL migrations. Today I've been reading the new tool created by the same guy that created SQLAlchemy to do the migrations: alembic. It is really easy, and removes the duplication problem reported by you in your post. Thus, I'll use alembic as it is pretty simple and keeps the model not too verbose. The migrations are going to be used only for migrations, nothing else.

from pybossa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.