# MgGraph redirects to localhost

**URL:** <https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618>\
**Category:** PowerShell Help\
**Created:** [July 18, 2023, 7:54am UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618 "2023-07-18T07:54:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![buszi99](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@buszi99](https://forums.powershell.org/u/buszi99)\
**Post date:** [July 18, 2023, 7:54am UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618/1 "2023-07-18T07:54:20Z")

</div>

Hi, I’m using powershell 7.3.5. When i type "Connect-Graph -scopes “User.Read.All” it opens a new tap in browser. When i try to log in i’m redirected to localhost:// and i can’t process next steps to log in to MS Graph. This doesn’t happen in PowerShell 5. Do you know how to fix it ?

---

<div class="post-metadata">

**Author:** ![neemobeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/neemobeer/32/4087_2.png) [@neemobeer](https://forums.powershell.org/u/neemobeer)\
**Post date:** [July 18, 2023, 2:25pm UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618/2 "2023-07-18T14:25:37Z")

</div>

I believe that is the Oauth callback and is expected. You should be connected and can simply close that window.

---

<div class="post-metadata">

**Author:** ![buszi99](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@buszi99](https://forums.powershell.org/u/buszi99)\
**Post date:** [July 19, 2023, 8:48am UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618/3 "2023-07-19T08:48:58Z")

</div>

After it opens an window in browser

 ![image](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/7/7179da0690aafc1d493d5c3d283550d6cc5e7b5e.png)  
nothing happens and i’m not logged in

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [July 19, 2023, 1:47pm UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618/4 "2023-07-19T13:47:29Z")

</div>

What module are you using? I don’t recall ever seeing Connect- **Graph** cmdlet in any Microsoft module. Are you using some 3rd party module? If so, I recommend using one of MS modules or directing your issue at the 3rd party.

---

<div class="post-metadata">

**Author:** ![buszi99](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@buszi99](https://forums.powershell.org/u/buszi99)\
**Post date:** [July 19, 2023, 2:25pm UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618/5 "2023-07-19T14:25:43Z")

</div>

I’m using Microsoft graph module

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [July 19, 2023, 3:58pm UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618/6 "2023-07-19T15:58:28Z")

</div>

Not with Connect-Graph. Perhaps you can show us the actual command you’re running? Can you show what version of the module you’re using?

```auto
Get-Module -Name microsoft.graph -ListAvailable

```

---

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [July 19, 2023, 4:22pm UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618/7 "2023-07-19T16:22:04Z")

</div>

Doug, I show it as an Alias:

```auto
Alias Connect-Graph 1.28.0 Microsoft.Graph.Authentication

```

---

<div class="post-metadata">

**Author:** ![buszi99](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@buszi99](https://forums.powershell.org/u/buszi99)\
**Post date:** [July 19, 2023, 4:25pm UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618/8 "2023-07-19T16:25:45Z")

</div>

![image](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/e/eb861be4010c21a2c93e9680e2511b63526a78f4.png)

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [July 19, 2023, 5:12pm UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618/9 "2023-07-19T17:12:40Z")

</div>

Thanks Tony! Buszi99, after you run the command you are prompted and able to input your credentials, correct? Then the next page to load is probably this

![image](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/3/39017f4ef39b4782a0400235e92ce1d31c1f80ea.png)

which in your case is coming up with the SSL protocol error. What browser did it open? You can try the command like this and choose the browser to use. It doesn’t even have to be on the same system you are trying to log in on.

```auto
Connect-MgGraph -Scopes user.read.all -UseDeviceAuthentication

To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code ABCDEF12345 to authenticate.

```

Probably an issue with enabled cryptographic providers on the system you’re using or in the browser

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:14pm UTC](https://forums.powershell.org/t/mggraph-redirects-to-localhost/22618/10 "2024-05-16T20:14:48Z")

</div>


