我正在使用此程序包https://www.nuget.org/packages/Microsoft.Identity.Client 验证用户,auth工作正常,问题是,我正在考虑使用登录后获得的令牌来获取用户名和电子邮件(因为我不仅需要访问收件箱,联系人和日历;还要使用电子邮件将用户链接到rol)。 问题是,当我得到令牌时,我得到一个长字符串作为userId(我猜加密)。有什么方法可以使用这个包来收到电子邮件吗?
这是我获得令牌的部分
public SessionTokenCache(string userId, HttpContextBase httpContext)
{
this.userId = userId;
cacheId = userId + "_TokenCache";
this.httpContext = httpContext;
BeforeAccess = BeforeAccessNotification;
AfterAccess = AfterAccessNotification;
Load();
}
答案 0 :(得分:0)
获得令牌后,您可以使用Graph API获取登录用户的详细信息吗?结果是Json,它可以用来提取你想要的位。
<?php
include '../Accounts/Header.php';
include '../Database/Dbconnect.php';
$uJobId = (int)$_POST["JobId"];
$uJobSubject = mysql_real_escape_string($_POST["uJobSubject"]);
$uJobCompany = mysql_real_escape_string($_POST["uJobCompany"]);
$uJobSalary = mysql_real_escape_string($_POST["uJobSalary"]);
$uJobLocation = mysql_real_escape_string($_POST["uJobLocation"]);
$query = "UPDATE Jobs
SET JobSubject = '$uJobSubject',
JobCompany = '$uJobCompany',
JobSalary = '$uJobSalary',
JobLocation - $uJobLocation'
WHERE JobId='$uJobId'";
mysql_query($query)or die(mysql_error());
if(mysql_affected_rows()>=1){
echo "<p>($uJobId) Record Updated<p>";
}else{
echo "<p>($uJobId) Not Updated<p>";
}
?>