The question is: how to get access_token from Google during authorization?
I do this:
1) I get the code parameter:
https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=ΠΌΠΎΠΉ_id&redirect_uri=ΠΌΠΎΠΉ_url&scope=email profile 2) send the request:
$params = array( "code" => $data['code'] , "client_id" => "ΠΌΠΎΠΉ_id" , "client_secret" => "ΡΠ΅ΠΊΡΠ΅Ρ" , "redirect_uri" => "ΠΌΠΎΠΉ_url" , "grant_type" => "authorization_code" ) ; $url = 'https://accounts.google.com/o/oauth2/token' ; $token = json_decode(file_get_contents($url . '?' . http_build_query($params)), true) ; But I get the answer:
{ "error" : "invalid_request" } What am I doing wrong?