How to get oauth access token data saved in database

15 views
Skip to first unread message

prosh...@gmail.com

unread,
Aug 13, 2018, 3:23:29 PM8/13/18
to Django users

To be able to make API calls on behalf of the user who granted access to django app, I have done the following :

I have added the field below to the UserAssociation class in the django-authopenid models (see link line 54) :

data_access_token = models.CharField(max_length=255)

In the complete_oauth1_signin request in the django-authopenid views (see link line 428):

I have added :

access_token_data = oauth._get_access_token_data()

(fyi: _get_access_token_data is from the OAuthConnection class in the util.py line 1005)

and I have added :

 return finalize_generic_signin( request=request, user=user, user_identifier=user_id, login_provider_name=oauth_provider_name, link_token=access_token_data, redirect_url=next_url )

In addition in the create_authenticated_user_account in the views.py (see link line 118), I have added :

 UserAssociation( openid_url = user_identifier, user = user, provider_name = login_provider_name, data_access_token = link_token last_used_timestamp = timezone.now() ).save()

After the oauth flow processing, the openid_url is saved in the user association table but the access token data is not stored in this table


Please tell me what action shall I do to be able to store oauth access token data

Reply all
Reply to author
Forward
0 new messages