-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"WARNING: It doesn't look like there was a valid access token" when using Connect-MSGraph #2
Comments
What version of PowerShell are you running on ? I've just checked this with version 5 and version 7 and it appears to working here. If run with no other parameters and you have no window tenant it will attempt to display a logon dialog and this won't work with PowerShell 6, or on Non-windows versions of PowerShell . |
I've just seen my mail, it would have helped if you'd said there was an error message before the warning. That suggests that for whatever reason it doesn't like the account you're using. I can sign in with both my Azure AD account and my Microsoft-Account so I'm stuck for what to suggest. To answer your other question Microsoft came out with their own official module for MSGraph shortly after I finished this one, and killed any interest there might have been in it. So I haven't changed anything since August 2019. |
Powershell version is 5.1.18362.752
You have the following message:
Write-Host -ForegroundColor Red "Using the default / sample app ID. You should edit the .PSM1 file and either replace the ID with your own, or remove this message"
But there’s no .psm1 file anywhere in your repository.
I updated lines 10 and 11 with my own Client ID and “common” as the Tenant (which is supposed to work with Live IDs).
Now I get this after being prompted for WINDOWS credentials rather than getting the oAuth page on the web:
Invoke-RestMethod : {"error":"invalid_grant","error_description":"AADSTS50034: The user account {EmailHidden} does not exist in
the outlook.com directory. To sign into this application, the account must be added to the directory.\r\nTrace ID:
141def9f-f351-4a8e-930e-a49a70e46100\r\nCorrelation ID: 4d946f4d-ff5d-43ce-ba74-db24b6999a86\r\nTimestamp: 2020-04-13
20:56:51Z","error_codes":[50034],"timestamp":"2020-04-13 20:56:51Z","trace_id":"141def9f-f351-4a8e-930e-a49a70e46100","correlation_
id":"4d946f4d-ff5d-43ce-ba74-db24b6999a86","error_uri":"https://login.microsoft.com/error?code=50034"}
At C:\Users\stblr\OneDrive\Documents\WindowsPowerShell\Modules\MsftGraph\1.0.1\Graph.ps1:223 char:13
+ Invoke-RestMethod -Method Post -Uri $tokenUri -Body @{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
From: jhoneill <[email protected]>
Sent: Monday, April 13, 2020 4:43 PM
To: jhoneill/MsftGraph <[email protected]>
Cc: Steven Buehler <[email protected]>; Author <[email protected]>
Subject: Re: [jhoneill/MsftGraph] "WARNING: It doesn't look like there was a valid access token" when using Connect-MSGraph (#2)
What version of PowerShell are you running on ? I've just checked this with version 5 and version 7 and it appears to working here. If run with no other parameters and you have no window tenant it will attempt to display a logon dialog and this won't work with PowerShell 6, or on Non-windows versions of PowerShell .
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#2 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AM53USQYVCG2TCANM4K4POLRMN2NHANCNFSM4MHCTARA>.
|
Leave the tennant ID blank, otherwise it will assume you want to hand it a credential object and a logon with an azure ID account in that tennant. The message you emailed me has a link to here https://login.microsoft.com/error?code=50034 Which says The user that attempted to sign in doesn't exist in this tenant. This can occur because the user mis-typed their username, or isn't in the tenant. An application may have chosen the wrong tenant to sign into, and the currently logged in user was prevented from doing so since they did not exist in your tenant. If this user should be able to log in, add them as a guest. See docs here: https://docs.microsoft.com/azure/active-directory/b2b/add-users-administrator I can't get a bogus outlook.com account to give that error with the tenant ID left blank. |
Receiving the following error when sending
Connect-MSGraph -ForceNew
:The text was updated successfully, but these errors were encountered: