phoneAuthenticationMethod API returning unauthenticated

Hamza Jeljeli 1 Reputation point
2021-03-29T10:23:06.183+00:00

Hello There,

I've been trying to Create a new phoneAuthenticationMethod using the phoneAuthenticationMethod resource in Microsoft Graph API using the documentation found in this link : https://learn.microsoft.com/en-us/graph/api/authentication-post-phonemethods?view=graph-rest-beta&tabs=http . When i try to add a new phone number (using Graph Explorer for example), it returns the following error :

{  
    "error": {  
        "code": "unauthenticated",  
        "message": "The calling app is not authenticated.",  
        "innerError": {  
            "message": "The calling app is not authenticated.",  
            "date": "2021-03-29T10:08:51",  
            "request-id": "7ca15ea3-d605-43d6-9fbe-acbb0d609898",  
            "client-request-id": "5a77eccd-d7e7-cff2-eee1-a29094d86ba8"  
        }  
    }  
}  

82347-capture.jpg

Permissions for the use of the API are already consented;

Any help is much appreciated !

Microsoft Security Microsoft Entra Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. Randy Zellner 11 Reputation points
    2021-11-22T09:05:06.453+00:00

    Quick FYI. I ran into the same problem using the Microsoft Graph SDK PowerShell module (New-MgUserAuthinticationPhoneMethod). What I discovered in this use-case is that the error only occurs when you attempt to add the authentication method to the same account that is authenticated through PowerShell. This occurs even though the self-target scope "UserAuthenticationMethod.ReadWrite" as well as the all users scope "UserAuthenticationMethod.ReadWrite.All" were both added to the session. However, if you attempt the same command against another user account, it succeeds.

    2 people found this answer helpful.
    0 comments No comments

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.