【发布时间】:2017-07-10 16:03:18
【问题描述】:
我正在与一位客户合作,他将使用 Brightspace API 来构建 Salesforce 和 D2L 的 Brightspace 之间的集成。 我们目前正在尝试利用 Oauth2.0 来验证必要的 API 调用。我们已经在他们的 Brightspace 网站中创建了所需的 Oauth 应用程序。
发送以下请求时:
HttpRequest req = new HttpRequest();
//req.setEndpoint('callout:D2L');
String clientId = 'retrieved from registered app in Bspace';
String clientSecret = 'retrieved from registered app in Bspace';
String refreshToken = '';
String scope = 'core:*:*';
String redirectUri = 'https://test.salesforce.com/services/auth/oauth/00D0S0000000VTwUAM/D2L';
req.setEndpoint('https://auth.brightspace.com/oauth2/auth?response_type=code&client_id=' + clientId + '&client_secret=' +clientSecret+'&scope=' +scope);
//String reqbody = 'grant_type=refresh_token&client_id='+clientId+'&client_secret='+clientSecret;
//req.setBody(reqbody);
//req.setheader('client_id',clientId);
//req.setheader('client_secret',clientSecret);
req.setheader('grant_type','refresh_token');
//req.setheader('response_type','code');
req.setheader('redirect_uri',redirectUri);
//req.setheader('refresh_token',refreshToken);
req.setMethod('GET');
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getBody());
System.debug('Response: ' + res);
他们收到以下内容...
错误信息: System.HttpResponse[状态=找到,状态代码=302]
对这里出了什么问题有什么想法吗?
麦克
【问题讨论】: