I am developing an application based on google Oauth. Now my all authentications are done. Even I have now the a开发者_如何学运维ccess token and secret. Now I dont know how to use this access token and secret. Please I really need Help on this. I have already done the hard work which is getting access token and secret. Only need to know how to use this token and secret to call an api.
To use the access key/secret you
- set inputparameters for the google client service
- create a token using the access key and secret, and the inputparameters
- set the token in the google client service
In Python, using the gdata library:
self.gd_client.SetOAuthInputParameters(
gdata.auth.OAuthSignatureMethod.HMAC_SHA1,
self.consumer_key, consumer_secret=self.consumer_secret)
oauth_input_params = gdata.auth.OAuthInputParams(
gdata.auth.OAuthSignatureMethod.HMAC_SHA1,
self.consumer_key, consumer_secret=self.consumer_secret)
oauth_token = gdata.auth.OAuthToken(key=access_key,
secret=access_secret,
scopes=gdata.gauth.AUTH_SCOPES,
oauth_input_params=oauth_input_params)
self.gd_client.SetOAuthToken(oauth_token)
After that you can call the service methods to retrieve the data.
Nico
精彩评论