Skip to content

Commit

Permalink
임시
Browse files Browse the repository at this point in the history
  • Loading branch information
200516bb committed Jul 24, 2023
1 parent 0e10c30 commit 11fa374
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
18 changes: 12 additions & 6 deletions app/api/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,15 @@ def get(self):
},
).json()

access_token = oauth_token["access_token"]
profile_request = requests.get(
"https://kapi.kakao.com/v2/user/me", headers={"Authorization": f"Bearer {access_token}"}
).json()

return { 'oauth_token': profile_request }
return { 'code': code }
# access_token = oauth_token["access_token"]
# profile_request = requests.get(
# "https://kapi.kakao.com/v2/user/me", headers={"Authorization": f"Bearer {access_token}"}
# ).json()

# info = {
# 'id': profile_request['oauth_token']['id'],
# 'connected_at': profile_request['oauth_token']['connected_at']
# }

# return info
13 changes: 13 additions & 0 deletions app/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ class User(db.Model):
deleted_at = db.Column(db.DateTime(), nullable=True)
reset_pw = db.Column(db.String(200), nullable=True)

class LocalAuth(db.Model):
id = db.Column(db.String(100), primary_key=True, nullable=False)
user_id = db.Column(UUID(as_uuid=True), db.ForeignKey('user.id', ondelete='CASCADE'))
password = db.Column(db.String(200), nullable=False)
user = db.relationship('User', backref='local_auth')

class SocialAuth(db.Model):
id = db.Column(db.String(100), primary_key=True, nullable=False)
user_id = db.Column(UUID(as_uuid=True), db.ForeignKey('user.id', ondelete='CASCADE'))
social_type = db.Column(db.String(50), nullable=False)
access_token = db.Column(db.String(200), nullable=True)
connected_at = db.Column(db.DateTime(), nullable=True)
user = db.relationship('User', backref='social_auth')

class UserDelete(db.Model):
reason_id = db.Column(db.Integer, db.ForeignKey('user_delete_reason.id', ondelete='CASCADE'))
Expand Down

0 comments on commit 11fa374

Please sign in to comment.