Method Web.Auth.OAuth2.Base()->request_access_token()
- Method
request_access_token
string|zerorequest_access_token(string|zerooauth_token_uri,stringcode,void|function(bool,string:void)async_cb)- Description
Requests an access token.
- Throws
An error if the access token request fails.
- Parameter
oauth_token_uri An URI received from get_auth_uri().
- Parameter
code The code returned from the authorization page via get_auth_uri().
- Parameter
async_cb If given an async request will be made and this function will be called when the request is finished. The first argument passed to the callback will be
trueorfalsedepending on if the request was successfull or not. The second argument will be a string. If the request failed it will be an error message. If it succeeded it will be the result as a string encoded with encode_value().- Returns
If
OKa Pike encoded mapping (i.e it's a string) is returned which can be used to populate an Web.Auth.OAuth2 object at a later time.The mapping looks like
"access_token":string"expires":int"created":int"refresh_token":string"token_type":stringDepending on the authorization service it might also contain more members.