instagram login

64 views
Skip to first unread message

www.diazluis.com

unread,
Apr 19, 2015, 6:44:40 PM4/19/15
to web...@googlegroups.com
greetings,
one could publish the adapted code
to login on instagram?

try to, but I overcame :(


I do not have the ability to adapt
oauth20_account.py to work with it:

from instagram.client import InstagramAPI
instagram_api = InstagramAPI(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, redirect_uri=REDIRECT_URI)
auth.settings.login_url = instagram_api.get_authorize_login_url(scope = 'basic')

instagram_code = request.vars.code or None

if instagram_code:
    instagram_token, user_info = instagram_api.exchange_code_for_access_token(code)

Kenneth

unread,
May 9, 2015, 7:06:11 PM5/9/15
to web...@googlegroups.com
This is what I've added on db.py. Hope this helps.

==============

from instagram.client import InstagramAPI
access_token = access_token
client_secret= client_secret
client_id = client_id
redirect_uri = redirect_uri

auth = Auth(db)

auth_table = db.define_table(
    auth.settings.table_user_name,
    Field('fullname', 'string', default=""),
    Field('first_name', length=128,default=''),
Field('last_name', length=128,default=''),
Field('email', length=128,default=''),
    Field('username', 'string', unique=True),
    Field('user_bio', 'text', default=""),
    Field('website', 'string', default=""),
    Field('profile_picture', 'string', default=""),
    Field('instagram_id', 'string', unique=True),
    Field('password', 'password', length=256, readable=False, label='Password'),
    Field('access_token','string'),
    Field('registration_id', length=128, default= "", writable=False, readable=False))

auth_table.username.requires = IS_NOT_IN_DB(db, auth_table.username)
auth.define_tables()

class InstagramOauth():
def login_url(self, next="/"):
from instagram import client
instagram_client = client.InstagramAPI(client_id= client_id, client_secret=client_secret, redirect_uri=redirect_uri)
return instagram_client.get_authorize_url(scope=["likes","comments"])
def get_user(self):
from instagram import client
instagram_client = client.InstagramAPI(client_id= client_id, client_secret=client_secret, redirect_uri=redirect_uri)
if request.vars.code:
code = request.vars.code
access_token, instagram_user = instagram_client.exchange_code_for_access_token(code)
return dict(username = instagram_user['username'],instagram_id = instagram_user['id'],user_bio=instagram_user['bio'],website = instagram_user['website'],profile_picture = instagram_user['profile_picture'],full_name=instagram_user['full_name'],registration_id = instagram_user['id'],access_token=access_token)

auth.settings.login_form = InstagramOauth()
Reply all
Reply to author
Forward
0 new messages