Google API: getting Credentials from refresh token with oauth2client.client

前端 未结 10 1871
失恋的感觉
失恋的感觉 2020-11-29 05:06

I am using googles official oauth2client.client to access the google plus api. I have a refresh token (that does not expire) stored in a database, and need to recreate the

10条回答
  •  执念已碎
    2020-11-29 05:17

    I use: oauth2client.client.GoogleCredentials

        cred = oauth2client.client.GoogleCredentials(access_token,client_id,client_secret,
                                              refresh_token,expires_at,"https://accounts.google.com/o/oauth2/token",some_user_agent)
        http = cred.authorize(httplib2.Http())
        cred.refresh(http)
        self.gmail_service = discovery.build('gmail', 'v1', credentials=cred)
    

提交回复
热议问题