How to get oauth access token data saved in database

261 views Asked by At

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

  1. 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)
    
  2. 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()
    

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

  3. 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)
    
  4. 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()
    

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

0

There are 0 answers