def fetch_access_token(self, code, redirect_uri):
"""Step 2: Given the code from fitbit from step 1, call
fitbit again and returns an access token object. Extract the needed
information from that and save it to use in future API calls.
the token is internally saved
"""
auth = OAuth2Session(self.client_id, redirect_uri=redirect_uri)
self.token = auth.fetch_token(
self.access_token_url,
username=self.client_id,
password=self.client_secret,
code=code)
return self.token
评论列表
文章目录