Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
Use the Google Userinfo API instead of Google Plus
Browse files Browse the repository at this point in the history
  • Loading branch information
xabiugarte committed Feb 11, 2019
1 parent 41aedd7 commit 7d1f021
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
10 changes: 4 additions & 6 deletions server/first_core/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,10 @@ def login_step_2(self, auth_code, url, login=True):

if not oauth.access_token_expired:
http_auth = oauth.authorize(httplib2.Http())
service = discovery.build('plus', 'v1', http_auth)
info = service.people().get(userId='me', fields='displayName,emails')
info = info.execute()
email = info['emails'][0]['value']
self.request.session['info'] = {'name' : info['displayName'],
'email' : email}
service = discovery.build('oauth2', 'v2', http_auth)
response = service.userinfo().v2().me().get().execute()
self.request.session['info'] = {'name' : response['name'],
'email' : response['email']}

expires = credentials['id_token']['exp']
#expires = datetime.datetime.fromtimestamp(expires)
Expand Down
6 changes: 3 additions & 3 deletions server/www/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-25 16:11
# Generated by Django 1.11.18 on 2019-02-11 15:48
from __future__ import unicode_literals

from django.db import migrations, models
Expand Down Expand Up @@ -29,7 +29,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=16, unique=True)),
('description', models.CharField(max_length=128)),
('description', models.CharField(max_length=256)),
('path', models.CharField(max_length=256)),
('obj_name', models.CharField(max_length=32)),
('active', models.BooleanField(default=False)),
Expand Down Expand Up @@ -109,7 +109,7 @@ class Migration(migrations.Migration):
('rank', models.BigIntegerField(default=0)),
('active', models.BooleanField(default=True)),
('service', models.CharField(max_length=16)),
('auth_data', models.CharField(max_length=4096)),
('auth_data', models.CharField(max_length=32768)),
],
options={
'db_table': 'User',
Expand Down
2 changes: 1 addition & 1 deletion server/www/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class User(models.Model):
active = models.BooleanField(default=True)

service = models.CharField(max_length=16)
auth_data = models.CharField(max_length=4096)
auth_data = models.CharField(max_length=32768)

@property
def user_handle(self):
Expand Down

0 comments on commit 7d1f021

Please sign in to comment.