Skype for Business を現在の AngularJS Web アプリケーションに統合しようとしています。https://msdn.microsoft.com/en-us/library/office/mt622687(v=office.16).aspx の手順に従いましたが、サインインできません。
同じ要件を持つアプリケーションに以前に Outlook (O365) を統合したので、アプリケーションは Azure AD に適切に登録されていると思います。
そこで、次の初期化を使用して、 adalAuthenticationServiceProviderを介して Office 365 Online でユーザーを認証します (以下の例では、tenant と clientId の一部をマスクしています)。
var endpoints = {
'https://outlook.office365.com': 'https://outlook.office365.com',
'https://webdir.online.lync.com': 'https://webdir.online.lync.com'
};
// Initialize the ADAL provider with your tenant name and clientID (found in the Azure Management Portal).
adalAuthenticationServiceProvider.init(
{
tenant: 'xxxxxxxxxxxx1.onmicrosoft.com',
clientId: '8720xxxx-xxxx-xxxx-xxxx-xxxxe2a3a20c',
redirectUri: 'http://localhost/defaultDashboard',
postLogoutRedirectUri: 'http://localhost/defaultDashboard',
cacheLocation: 'localStorage',
anonymousEndpoints: ["/"],
endpoints: endpoints
},
$httpProvider
);
次に、Skype for Business Online へのサインインを試みた後、adalAuthenticationService内に格納されている Azure AD から受け取ったアクセス トークンを使用してユーザーのサインインを試みます。
var config = {
apiKey: 'a42fcebd-5b43-4b89-a065-74450fb91255', // SDK
apiKeyCC: '9c967f6b-a846-4df2-b43d-5167e47d81e1' // SDK+UI
};
Skype.initialize({ apiKey: config.apiKey }, function (api) {
var app = new api.application;
app.signInManager.state.changed(function (state) {
console.log("Login State: " + state);
});
app.signInManager.signIn({
"client_id": "8720xxxx-xxxx-xxxx-xxxx-xxxxe2a3a20c", //GUID obtained from Azure app registration.
"origins": ["https://webdir.online.lync.com/autodiscover/autodiscoverservice.svc/root"],
"cors": true,
"redirect_uri": 'http://localhost/defaultDashboard', // Can be any location in the current site. (Any valid Url)
"version": 'xxxxx/1.0.0.0'
});
var resource = adalAuthenticationService.getResourceForEndpoint('localhost');
var tokenStored = adalAuthenticationService.getCachedToken(resource);
if (tokenStored) {
var Bearercwt = 'Bearer cwt=';
var Bearer = 'Bearer ';
var cwt = 'cwt';
if (tokenStored.indexOf(cwt) == -1) {
tokenStored = Bearercwt + tokenStored;
}
if (tokenStored.indexOf(Bearer) == -1) {
tokenStored = Bearer + tokenStored;
}
var options = {
auth: function (req, send) {
req.headers['Authorization'] = tokenStored.trim();
return send(req);
},
domain: 'localhost'
};
app.signInManager.signIn(options).then(
function () {
console.log('Signed in as ' + app.personsAndGroupsManager.mePerson.name());
},
function(err) {
console.log('Sign in failed: '+err);
});
}
}, function (err) {
console.log("cannot load the sdk package", err.toString());
});
最初に、 Development Docが 2 つの別々のsignInManager.signIn呼び出しを提案している理由がよくわからないことに注意したいと思います。ただし、私の本当の問題は、最初のサインイン呼び出し ( clientIdを使用) が、「無効な資格情報」のために拒否された GET 呼び出しをトリガーすることです (以下を参照)。
webdirca1.online.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user: 401
その後、この同じ呼び出しが 3 秒ごとにループでトリガーされ、今度は「サービスはこのオリジンからのクロス ドメイン リクエストを許可しません」というエラーを返します (以下を参照)。
webdirca1.online.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user: 403
最初のサインイン呼び出しをコメントアウトし、Azure AD 認証から受け取ったアクセス トークンのみを使用してサインインしようとすると、https: //lyncdiscoverinternal.localhost/xframeと https :/ からの 2 つの net::ERR_SSL_PROTOCOL_ERROR lyncdiscover エラーに直面します。 /lyncdiscover.localhost/xframe それぞれ (以下を参照してください。PS ドメインを localhost から Azure AD テナントに変更すると、同じエラーが発生します)。
Skype for Business Online 用の Web SDK アプリケーションを開発するための前提条件を満たしていませんか? どんな助けでも大歓迎です。