You need to sign in to do that
Don't have an account?
yogeshsharma
Unable to get the authorization code from the google
Hi All,,
I am trying to get the authorization token from the salesforce for the google drive access. But I am getting the bad response error(400 ) for the access. I am not able to decipher the reason in the code.
String messageBody='';
Initialize();
httpReq.setMethod('POST');
httpReq.setEndpoint('https://accounts.google.com/o/oauth2/token');
httpReq.setHeader('content-type',
'application/x-www-form-urlencoded');
messageBody ='client_id='+'288961038342.apps.googleusercontent.com'+
'&client_secret='+'OHLLahnI9DKD1xR5gVnyGA36'+'&redirect_uri='+'https://login.salesforce.com/services/authcallback/00D90000000dAqaEAE/GoogleLogin'+
'&grant_type='+'authorization_code';
System.debug('messagebody'+messageBody );
/* if(tokenType=='ALL')
messageBody = messageBody +
'&code='+<Fetch Authorization Code from Key Safe>+
'&redirect_uri='+<Fetch Redirect URI from EndPoint>+
'&grant_type='+'authorization_code';
else if(tokenType=='ACCESS_TOKEN')
messageBody = messageBody +
'&refresh_token='+<Fetch Refresh Token from Key Safe>+
'&grant_type='+'refresh_token';
*/
httpReq.setHeader('Content-length',
String.valueOf(messageBody.length()));
Please somebody help in this regard
I am trying to get the authorization token from the salesforce for the google drive access. But I am getting the bad response error(400 ) for the access. I am not able to decipher the reason in the code.
String messageBody='';
Initialize();
httpReq.setMethod('POST');
httpReq.setEndpoint('https://accounts.google.com/o/oauth2/token');
httpReq.setHeader('content-type',
'application/x-www-form-urlencoded');
messageBody ='client_id='+'288961038342.apps.googleusercontent.com'+
'&client_secret='+'OHLLahnI9DKD1xR5gVnyGA36'+'&redirect_uri='+'https://login.salesforce.com/services/authcallback/00D90000000dAqaEAE/GoogleLogin'+
'&grant_type='+'authorization_code';
System.debug('messagebody'+messageBody );
/* if(tokenType=='ALL')
messageBody = messageBody +
'&code='+<Fetch Authorization Code from Key Safe>+
'&redirect_uri='+<Fetch Redirect URI from EndPoint>+
'&grant_type='+'authorization_code';
else if(tokenType=='ACCESS_TOKEN')
messageBody = messageBody +
'&refresh_token='+<Fetch Refresh Token from Key Safe>+
'&grant_type='+'refresh_token';
*/
httpReq.setHeader('Content-length',
String.valueOf(messageBody.length()));
Please somebody help in this regard
Eli Flores, SFDC Dev
Assuming you already have have token, you are missing the code parameter.
Eli Flores, SFDC Dev
err i mean assuming you alraedy have the authorization code, you are missing the code parameter