You need to sign in to do that
Don't have an account?
bingi crm 7
I am try to box.com integration hiting error":"unauthorized_client","error_description":"The grant type is unauthorized for this client_id"
I am try to integrated the values of this my code get json respons will not access throw the showing error
error":"unauthorized_client","error_description":"The grant type is unauthorized for this client_id"
RestApi:
Class:-
public class Trybox {
public string temp{get;set;}
public PageReference Getauth() {
return new PageReference('https://account.box.com/api/oauth2/authorize?response_type=code&client_id=wx7fximheqlekhc5e8ffiu14oa70o7m2');
}
public void Getauthen(){
string code = apexpages.currentpage().getparameters().get('code');
HttpRequest req = new HttpRequest();
//searchtext.replaceAll(' ','+');
req.setEndpoint('https://api.box.com/oauth2/token');
req.setMethod('POST');
req.setHeader('Accept','application/json');
req.setBody('grant_type=authorization_code&code='+code+'&client_id=wx7fximheqlekhc5e8ffiu14oa70o7m2&client_secret=Ip8tJlTRAROhb6HMZ0uE1E7Uo8p0gsKb');
Http http = new Http();
HTTPResponse res = http.send(req);
temp = res.getBody();
}
}
visualforce:-
<apex:page controller="Trybox">
<apex:form >
<apex:commandButton value="Get Auth" action="{!Getauth}"/>
</apex:form>
</apex:page>
error":"unauthorized_client","error_description":"The grant type is unauthorized for this client_id"
RestApi:
Class:-
public class Trybox {
public string temp{get;set;}
public PageReference Getauth() {
return new PageReference('https://account.box.com/api/oauth2/authorize?response_type=code&client_id=wx7fximheqlekhc5e8ffiu14oa70o7m2');
}
public void Getauthen(){
string code = apexpages.currentpage().getparameters().get('code');
HttpRequest req = new HttpRequest();
//searchtext.replaceAll(' ','+');
req.setEndpoint('https://api.box.com/oauth2/token');
req.setMethod('POST');
req.setHeader('Accept','application/json');
req.setBody('grant_type=authorization_code&code='+code+'&client_id=wx7fximheqlekhc5e8ffiu14oa70o7m2&client_secret=Ip8tJlTRAROhb6HMZ0uE1E7Uo8p0gsKb');
Http http = new Http();
HTTPResponse res = http.send(req);
temp = res.getBody();
}
}
visualforce:-
<apex:page controller="Trybox">
<apex:form >
<apex:commandButton value="Get Auth" action="{!Getauth}"/>
</apex:form>
</apex:page>
Thanks!
AMit Singh