function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Manohar kumarManohar kumar 

how to get authorization code for onedrive ??

Hi All,

i have been trying to upload files to onedrive.its working when i paste the url in the browser for getting the authorization code but when i try to get it in the http get call its giving me 302 response code and in the location header its showing error=invalid_scope&error_description=The  provided  value  for  the  input  parameter  'scope'  is  not  valid.  The  scope  'wl.signi  nwl.offline_access  onedrive.readwrite'  does  not  exist.i am new in webservices so any help would be appreciated.

url i need to call:  https://login.live.com/oauth20_authorize.srf?client_id=xxxxxxx&scope=wl.signin wl.offline_access onedrive.readwrite
  &response_type=code&redirect_uri=https://xxxxxxxxxxxxxxxxxx.force.com/Redirect

my code 

public void GetCode(){
	      http h = new http();
	      httpRequest req = new httpRequest();
	    String Clientkey = EncodingUtil.urlEncode(key,'UTF-8');  
	      req.setMethod('GET');
	      string str1 ='wl.signi nwl.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;
	      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'));
      }