I'm trying to authenticate into Stack Exchange's API with the following URL:
https://stackexchange.com/oauth/dialog?client_id=3535&scope=write_access&redirect_uri=https://stackexchange.com/oauth/login_success
This returns a redirect with access_token into queryString:
The problem comes when I try to get the redirection with Curl: it return 500 internal server error.
EDIT
My idea is instantiate an OAuth2 class like this:
$oauth2 = new OAuth2('key', 'client_id', 'scope', 'redirect_uri');
$accessToken = $oauth2->getAccessToken();
// For auth require methods
$client = new Client('key', $accessToken);
// Without auth
$client = new Client();
I don't want to obtain the access_token manually pasting the URL in the browser. I want to generate the token with this four values.
So, any suggestion on how to implement the getAccessToken()
method?
access_token
and that's all you need from this step of the auth process.stackexchange.com/oauth/login_success
? Redirect to a page on your server. Or just do a self redirect and read the URL parameters on redirect.redirected_uri
when I use via terminal and in the localhost?