我正在使用PHP联盟的OAuth2客户端库来针对Azure Active Directory验证我的PHP应用程序。验证工作,但当我尝试获取登录用户的信息时,我得到了可怕的"访问令牌丢失或格式错误":
{
"odata.error":{
"code":"Authentication_MissingOrMalformed",
"message":{
"lang":"en",
"value":"Access Token missing or malformed."
},
"values":null
}
}
检查我使用的令牌,最后我看到一堆乱码,我觉得这可能是问题所在,因为其他一切看起来都是完整的:
{
"typ":"JWT",
"alg":"RS256",
"x5t":"xxxxxxx",
"kid":"xxxxxxx"
}{
"aud":"https://graph.windows.net/",
"iss":"https://sts.windows.net/xxxxxxxxxxxx/",
"iat":1432806357,
"nbf":1432806357,
"exp":1432810257,
"ver":"1.0",
"tid":"xxxxxxxxxxx",
"oid":"yyyyyyyyyyy",
"upn":"user@mydomain.onmicrosoft.com",
"puid":"yyyyyyyyyyyy",
"sub":"xyxyxyxyxyxyxyx",
"given_name":"First",
"family_name":"Last",
"name":"user",
"amr":[
"pwd"
],
"unique_name":"user@mydomain.onmicrosoft.com",
"appid":"xxxxxxxxxxxx",
"appidacr":"1",
"scp":"Directory.Read user_impersonation UserProfile.Read",
"acr":"1"
}�x·���mk���2_w}Qc��t�0n� ��!���w.@|~�)/�#SW��V��ؽ����8>f�ޒ�x��_����s��[������7�ٍ�=TpD��qI'R\���_*� 3�0P�M?���є�B�>ѣ �)?+Zxd晩�p_Z�������;�Bg���5v�s�Q`~ٛ1*2��)Q}ٙ�sS���vթ���݉���V@�-9�m��be��x+�| �Ë��b
知道这个胡言乱语来自哪里?这是阻止我检索用户数据的问题吗?
答案 0 :(得分:1)
乱码是令牌HMAC,您可以使用它来验证令牌是否有效。