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?

    1 answer 1

    You send a GET request, but you must POST. It is necessary through curl