AADSTS70002:验证凭据时出错。 AADSTS50126:无效的用户名或密码

时间:2018-12-19 07:28:00

标签: azure-active-directory microsoft-graph access-token

无法获取访问令牌,授予类型:密码

URL:

https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/token?resources=https%3A%2F%2Fgraph.microsoft.com%2F

请求:

  {'grant_type': 'password', 'client_id': <client_id>, 'scope': 'openid User.Read Mail.Read', 'username': '<email_id>', 'client_secret': '<client_secret>, 'password':<password>}

响应:

    {'correlation_id': 'bbe33e96-aeb8-4e8f-8a2f-1330510c298f', 
     'error_codes': [70002, 50126],
     'timestamp': '2018-12-19 06:58:03Z',
     'error': 'invalid_grant',
     'trace_id': 'c69686fb-a84e-4299-a72c-0cf079381300', 
     'error_description': 'AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password\r\nTrace ID: c69686fb-a84e-4299-a72c-0cf079381300\r\nCorrelation ID: bbe33e96-aeb8-4e8f-8a2f-1330510c298f\r\nTimestamp: 2018-12-19 06:58:03Z'}

任何人都可以找出问题所在。 用户名和密码正确。

2 个答案:

答案 0 :(得分:-1)

建议您尝试以下方式:

URL:

Post https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/token

内容类型:

application/x-www-form-urlencoded

请求正文:

client_id=<client_id>&
scope=https://graph.microsot.com/Mail.Read openid User.Read&
grant_type=password&
username=<email_id>&
client_secret=<client_secret>&
password=<password>

响应: enter image description here

答案 1 :(得分:-1)

对我来说,以下内容是在邮递员中解决的。

URL(POST):

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table border="0" class="document-as" color="black" id="table_serv" style="font-size: 12px;border-right:0" width="100%">
    <thead>
        <tr>
            <th style="text-align: center;color: white;font-weight: 600; width:5%"></th>
            <th style="text-align: left;color: white;font-weight: 600;width:35%;"><span style="font-family:verdana,geneva,sans-serif;"><span style="color:#000000;"><strong>Description</strong></span></span>
            </th>
            <th style="text-align: center;color: white;font-weight: 600;width:25%;"><span style="font-family:verdana,geneva,sans-serif;"><span style="color:#000000;"><strong>Selling Price</strong></span></span>
            </th>
            <th style="text-align: center;color: white;font-weight: 600;width:15%;"><span style="font-family:verdana,geneva,sans-serif;"><span style="color:#000000;"><strong>Quantity</strong></span></span>
            </th>
            <th style="text-align: center;color: white;font-weight: 600;width:15%"><span style="font-family:verdana,geneva,sans-serif;"><span style="color:#000000;"><strong>Total</strong></span></span>
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td class="serv-nomer" style=""><span style="font-family:verdana,geneva,sans-serif;">:0,00</span>
                <br> &nbsp;</td>
            <td style="text-align:left;"><span class="en_us" style=""></span><span class="de_de" style=""></span></td>
            <td class="serv-price" style=""><span>0,00 €</span></td>
            <td style=""><span style="font-family:verdana,geneva,sans-serif;">0,00</span></td>
            <td style=""><span style="font-family:verdana,geneva,sans-serif;"><strong>0,00 €</strong></span></td>
        </tr>
        <tr>
            <td class="serv-nomer" style=""><span style="font-family:verdana,geneva,sans-serif;">9:324,00</span>
                <br> &nbsp;</td>
            <td style="text-align:left;"><span class="en_us" style="">Justification safety (GOST-Norm)</span><span class="de_de" style="">Begründung Sicherheit (GOST-Norm)</span></td>
            <td class="serv-price" style=""><span>324,00 €</span></td>
            <td style="">1,00</td>
            <td style=""><span style="font-family:verdana,geneva,sans-serif;"><strong>324,00 €</strong></span></td>
        </tr>
        <tr>
            <td class="serv-nomer" style=""><span style="font-family:verdana,geneva,sans-serif;">SER20:432,00</span>
                <br> &nbsp;</td>
            <td style="text-align:left;"><span class="en_us" style="">Certificate TR CU 004/020/2011 for 5 Years</span><span class="de_de" style="">Zertifikat TR CU 004/020/2011 für 5 Jahre</span></td>
            <td class="serv-price" style=""><span>432,00 €</span></td>
            <td style="">1,00</td>
            <td style=""><span style="font-family:verdana,geneva,sans-serif;"><strong>432,00 €</strong></span></td>
        </tr>
        <tr>
            <td class="serv-nomer" style=""><span style="font-family:verdana,geneva,sans-serif;">7:34,00</span>
                <br> &nbsp;</td>
            <td style="text-align:left;"><span class="en_us" style="">Declaration TR ZU 04/2011 for  5 Years</span><span class="de_de" style="">Deklaration TR ZU 04/2011 for 5 Jahre</span></td>
            <td class="serv-price" style=""><span>34,00 €</span></td>
            <td style="">1,00</td>
            <td style=""><span style="font-family:verdana,geneva,sans-serif;"><strong>34,00 €</strong></span></td>
        </tr>
        <tr>
            <td class="serv-nomer" style=""><span style="font-family:verdana,geneva,sans-serif;">:0,00</span>
                <br> &nbsp;</td>
            <td style="text-align:left;"><span class="en_us" style=""></span><span class="de_de" style=""></span></td>
            <td class="serv-price" style=""><span>0,00 €</span></td>
            <td style=""><span style="font-family:verdana,geneva,sans-serif;">0,00</span></td>
            <td style=""><span style="font-family:verdana,geneva,sans-serif;"><strong>0,00 €</strong></span></td>
        </tr>
        <tr>
            <td class="serv-nomer" style=""><span style="font-family:verdana,geneva,sans-serif;">9:23,00</span>
                <br> &nbsp;</td>
            <td style="text-align:left;"><span class="en_us" style="">Justification safety (GOST-Norm)</span><span class="de_de" style="">Begründung Sicherheit (GOST-Norm)</span></td>
            <td class="serv-price" style=""><span>23,00 €</span></td>
            <td style="">1,00</td>
            <td style=""><span style="font-family:verdana,geneva,sans-serif;"><strong>23,00 €</strong></span></td>
        </tr>
        <tr>
            <td class="serv-nomer" style=""><span style="font-family:verdana,geneva,sans-serif;">SER20:43,00</span>
                <br> &nbsp;</td>
            <td style="text-align:left;"><span class="en_us" style="">Certificate TR CU 004/020/2011 for 5 Years</span><span class="de_de" style="">Zertifikat TR CU 004/020/2011 für 5 Jahre</span></td>
            <td class="serv-price" style=""><span>43,00 €</span></td>
            <td style="">1,00</td>
            <td style=""><span style="font-family:verdana,geneva,sans-serif;"><strong>43,00 €</strong></span></td>
        </tr>
        <tr>
            <td colspan="4" style=""><span>Sub Total</span></td>
            <td><span>856,00 €</span></td>
        </tr>
        <tr>
            <td colspan="4" style=""><span style="font-family:verdana,geneva,sans-serif;">Discount</span></td>
            <td><span style="font-family:verdana,geneva,sans-serif;">0,00 €</span></td>
        </tr>
        <tr>
            <td colspan="4" style=""><span style="font-family:verdana,geneva,sans-serif;">Total</span></td>
            <td><span style="font-family:verdana,geneva,sans-serif;">856,00 €</span></td>
        </tr>
        <tr>
            <td colspan="4" style=""><strong>&nbsp;&nbsp;&nbsp;&nbsp; Grand Total</strong></td>
            <td style=""><span><span><strong>1343,92 €</strong></span></span>
            </td>
        </tr>
    </tbody>
</table>

标题:

https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/token

请求正文(文本):

Content-Type 
application/x-www-form-urlencoded