You need to sign in to do that
Don't have an account?

getting an html in Onedrive response
Hi All,
i am trying to upload my files to onedrive.when i try to get the authentication code by calling a url in my get method but coming Status=OK, StatusCode=200.And in the body i am getting an html.pls help any help would be appreciated.And when i put the url in the body it works perfectly.
url i need to call: https://login.live.com/oauth20_authorize.srf?client_id=Clientkey&scope=wl.signin wl.offline_access onedrive.readwrite&response_type=code&redirect_uri=https://ascmanohar-developer-edition.ap2.force.com/Redirect
my code :
public void GetCode(){ http h = new http(); httpRequest req = new httpRequest(); String Clientkey = EncodingUtil.urlEncode(key,'UTF-8'); req.setHeader('Content-type', 'application/x-www-form-urlencoded'); req.setMethod('GET'); string str1 ='wl.signin wl.offline_access onedrive.readwrite'; string str2 = EncodingUtil.urlEncode(str1,'UTF-8'); string str ='https://login.live.com/oauth20_authorize.srf?client_id='+Clientkey+'&scope='+str2+'&response_type=code&redirect_uri='+redirect_uri; //str = EncodingUtil.urlEncode(str,'UTF-8'); system.debug('@@str'+str); req.setEndPoint(str); httpResponse res = h.send(req); system.debug('##res'+res); system.debug('######'+res.getBody()); system.debug('##getlocation##'+res.getHeader('Location')); }
See OAuth 2.0