I'm trying to get access to Google Drive API and I read documentation. My iOS app sends first request to ask for permission to endpoint https://accounts.google.com/o/oauth2/v2/auth.
User grants permission. I get a code. Next step is to authorization code for refresh and access tokens.
As for installed apps, I don't need to send client secret. In order to do that iOS app sends POST request to the endpoint:
https://www.googleapis.com/oauth2/v4/token
with headers:
Content-Type : application/x-www-form-urlencoded
body:
code={CODE_FROM_OAUTH_SERVER}&client_id={CLIENT_ID_FROM_CONSOLE}&redirect_uri={APP_BUNDLE_IDENTIFIER}:/code&grant_type=authorization_code
I get the response:
{
"error": "unsupported_grant_type",
"error_description": "Invalid grant_type: "
}
App is registered in Google console.
My question is am I doing something wrong?