Oauth 2.0 Cortana技能认证
我已经在我的Cortana通道(Microsoft)中启用了连接服务,并获得了BOT框架的令牌。 现在,我想通过使用注册的客户机id和secret从令牌中检索用户详细信息 BOT框架中的示例代码:Oauth 2.0 Cortana技能认证,oauth-2.0,token,botframework,cortana,user-information-list,Oauth 2.0,Token,Botframework,Cortana,User Information List,我已经在我的Cortana通道(Microsoft)中启用了连接服务,并获得了BOT框架的令牌。 现在,我想通过使用注册的客户机id和secret从令牌中检索用户详细信息 BOT框架中的示例代码: var authInfo = ((Activity)context.Activity).Entities.FirstOrDefault(e => e.Type.Equals("AuthorizationToken")); var token = authInfo.Prop
var authInfo = ((Activity)context.Activity).Entities.FirstOrDefault(e => e.Type.Equals("AuthorizationToken"));
var token = authInfo.Properties["token"].ToString();
有什么想法吗?退房。您可以选择提供程序检索令牌:
const botauth = require("botauth");
const DropboxOAuth2Strategy = require("passport-dropbox-oauth2").Strategy;
...
// Initialize with the strategies we want to use
var auth = new botauth.BotAuthenticator(server, bot, {
secret : "something secret",
baseUrl : "https://" + WEBSITE_HOSTNAME }
);
// Configure the Dropbox authentication provider using the passport-dropbox strategy
auth.provider("dropbox",
function(options) {
return new DropboxOAuth2Strategy(
{
clientID : DROPBOX_APP_ID,
clientSecret : DROPBOX_APP_SECRET,
callbackURL : options.callbackURL
},
function(accessToken, refreshToken, profile, done) {
profile.accessToken = accessToken;
profile.refreshToken = refreshToken;
done(null, profile);
}
);
}
);
如果您只想检索用户名和ID,可以从以下对象获取:
UserInfo : { "Name": { "GivenName": "XYZ", "FamilyName": "ABC" }, "Id": "something@outlook.com" }