HTTP Error 400. The request hostname is invalid on Getting a token request

MR 1 Reputation point
2022-11-08T10:57:48.21+00:00

I got the authorization code and after that i tried to fetch the token throwing me invalid hostname. Can someone please help me on this.
I did based on the instructions in the link below.
https://learn.microsoft.com/en-us/graph/auth-v2-user#1-register-your-app

258272-image.png

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vicky Kumar (Mindtree Consulting PVT LTD) 1,161 Reputation points Microsoft Employee
    2022-11-08T12:37:50.207+00:00

    Could you please check the redirect URI from your azure portal, If your app is single page application then you can add homepage ( localhost ) URI

    Steps to Add redirect URI from azure portal
    Azure Portal > Azure Active Directory > App Registrations > Search the application by using App ID or Name > open the app and click on authentication blade > update the Redirect URI.
    258218-image.png

    Hope this helps

    Thanks


  2. Zehui Yao_MSFT 5,876 Reputation points
    2022-11-09T02:33:10.197+00:00

    Hi @MR , please try to fill in all the parameters in body, and secondly, you don't need to use the %20 symbol between permissions in postman.

    258419-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.