def request_access_token( self, client_id, key, code, grant_type,<EOL>redirect_uri=None, method='<STR_LIT>' ):
if grant_type != '<STR_LIT>':<EOL><INDENT>raise Proauth2Error( '<STR_LIT>',<EOL>'<STR_LIT>' )<EOL><DEDENT>self._auth( client_id, key, method )<EOL>user_id = self._validate_request_code( code, client_id )<EOL>access_token = self._generate_token( <NUM_LIT:64> )<EOL>self.data_store.store( '<STR_LIT>', token=access_token, user_id=user_id,<EOL>client_id=client_id )<EOL>return { '<STR_LIT>':access_token, '<STR_LIT>':'<STR_LIT>' }<EOL>
request_access_token validates the client_id and client_secret, using the
provided method, then generates an access_token, stores it with the user_id
from the nonce, and returns a dictionary containing an access_token and
bearer token.
---
from the spec, it looks like there are different types of
tokens, but i don't understand the disctintions, so someone else can fix
this if need be.
regarding the method: it appears that it is intended for there to be
multiple ways to verify the client_id. my assumption is that you use the
secret as the salt and pass the hashed of the client_id or something, and
then compare hashes on the server end. currently the only implemented method
is direct comparison of the client_ids and client_secrets.
additional methods can be added to proauth2.auth_methods