- Get access token for user.
- Create a service for user.
- Generate a OAuth authorization URL.
- Process URL for OAuth verifications.
Low-level helper module does following operations for questions above:
Get access token for user:
- Generate a unique key consists of user's key and current host (different consumer key,secret so different services and access tokens are used for each hosts).
- Ask memcache or a storage mechanism to fetch token corresponding to that key.
- Return token.
- If there isn't a token return None.
Create a service for user:
Service is a GDocsService object that is used to make API calls.
- Create a service for the current host.
- Set service's input parematers to host's consumer_key and consumer_secret.
- Set encryption method to sha or rsa.
- Return service.
Generate a OAuth authorization URL:
- Fetch a request token.
- Save request token's secret to memcache for later use (when validating token).
- Generate a authorization URL from request token.
- Return URL.
Process URL for OAuth verifications:
- If request URL contains a verification key as GET parameter, parse it.
- Verify previously stored access token with parsed verification key.
- Store verified access token to memcache or datastore.
No comments:
Post a Comment