Comments (5)
Have you seen BrowserID from Mozilla? It seems pretty interesting :)
from pybossa.
@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.
@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.
@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.
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)
- Restrict Pybossa API calls for admin users HOT 2
- Base url for Pybossa HOT 1
- oauth/oauth2 howto ? HOT 1
- supervisor redis-sentinel conf file HOT 1
- vagrant up failed to populate DB HOT 2
- Remove social logins HOT 1
- Remove CKAN integration
- Remove Youtube importer
- Removing Flickr importer HOT 2
- use local imaries as tasks HOT 1
- Remove facebook_id, google_id, and twitter_id from user model
- redis set 104, 'Connection reset by peer' error HOT 1
- spelling error
- Docker Installation HOT 2
- Proposing a PR to fix a few small typos
- pyparsing version is incompatible with several packages
- Missing key in table 'project'
- Clean contributions of based on User_id and Project_Id
- issues trying to install a new server HOT 1
- How can I create Text based tasks in PYBOSSA?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pybossa.