Is there a reason for not automatically setting the access_token after a successful token exchange? I'd like (to implement) an (optional) automatic assignment of private $accessToken after a successful token exchange.
$code = '123abc';
$token = $api->tokenExchange($code, true); // To automatically store the token if successful.
Although I'd probably want the default for the 2nd argument to be true and make not assigning it automatically the optional version. This shouldn't break backward compatibility.
Alternatively setAccessToken() could attempt to get a token if a code instead of a token is supplied. I don't think that's the way to go though; you'd have to differentiate between tokens and codes, this would probably become a giant mess. Only pro is that I find this method name is a little bit more appropriate than tokenExchange().
Is there a reason for not automatically setting the
access_token
after a successful token exchange? I'd like (to implement) an (optional) automatic assignment ofprivate $accessToken
after a successful token exchange.Could be:
Although I'd probably want the default for the 2nd argument to be true and make not assigning it automatically the optional version. This shouldn't break backward compatibility.
Alternatively
setAccessToken()
could attempt to get a token if a code instead of a token is supplied. I don't think that's the way to go though; you'd have to differentiate between tokens and codes, this would probably become a giant mess. Only pro is that I find this method name is a little bit more appropriate thantokenExchange()
.Any thoughts?