winget-create icon indicating copy to clipboard operation
winget-create copied to clipboard

Unhandled exception. Octokit.ForbiddenException: Resource protected by organization SAML enforcement. You must grant your OAuth token access to this organization.

Open C8H17OH opened this issue 2 months ago • 0 comments

Brief description of your issue

Today when I want to use WinGetCreate to create a manifest, I was told that:

Token was invalid. Please generate a new GitHub token and try again.

So I ran wingetcreate token --store and signed into GitHub in the browser. It seemed succeeded, however, after that I got the following error message when running any command, even including wingetcreate token --clear and wingetcreate token --store:

Unhandled exception. Octokit.ForbiddenException: Resource protected by organization SAML enforcement. You must grant your OAuth token access to this organization.
   at Octokit.Connection.HandleErrors(IResponse response) in /_/Octokit/Http/Connection.cs:line 785
   at Octokit.Connection.RunRequest(IRequest request, CancellationToken cancellationToken, Func`2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 766
   at Octokit.Connection.Run[T](IRequest request, CancellationToken cancellationToken, Func`2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 751
   at Octokit.ApiConnection.Get[T](Uri uri, IDictionary`2 parameters)
   at Microsoft.WingetCreateCore.Common.GitHub.CheckAccess()
   at Microsoft.WingetCreateCLI.Commands.BaseCommand.CheckGitHubTokenAndSetClient()
   at Microsoft.WingetCreateCLI.Commands.BaseCommand.LoadGitHubClient(Boolean requireToken)
   at Microsoft.WingetCreateCLI.Program.Main(String[] args)
   at Microsoft.WingetCreateCLI.Program.<Main>(String[] args)
{"message":"Resource protected by organization SAML enforcement. You must grant your OAuth token access to this organization.","documentation_url":"https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/","status":"403"}

I don't know which step during the login was wrong, but now I could not even clear the access token. I remember there was a step to authorize my organization and I ignored it, but I don't know how to redo it now. I even tried to reinstall WinGetCreate but the token seemed not cleared, either.

If there is any other way to clear the token or sign in again please tell me, thanks.

Steps to reproduce

As above.

Expected behavior

Successfully stored the access token and access the GitHub repositories.

Actual behavior

As shown in the description.

Environment

> wingetcreate info
Windows Package Manager Manifest Creator v1.10.3.0
Copyright (c) Microsoft Corporation. All rights reserved.

Operating System: Microsoft Windows NT 10.0.26200.0
System Architecture: X64

Winget-Create Directories  Path                                                                                         
------------------------------------------------------------------------------------------------------------------------------------------
Logs                       %LOCALAPPDATA%\Packages\Microsoft.WindowsPackageManagerManifestCreator_8wekyb3d8bbwe\LocalState\DiagOutputDir
User settings              %LOCALAPPDATA%\Packages\Microsoft.WindowsPackageManagerManifestCreator_8wekyb3d8bbwe\LocalState\settings.json
Installer cache            %TEMP%\wingetcreate                                                                          

Links
------------------------------------------------------------------
Privacy Statement    https://aka.ms/winget-create-privacy
License Agreement    https://aka.ms/winget-create-license
Third Party Notices  https://aka.ms/winget-create-3rdPartyNotice
Homepage             https://aka.ms/winget-create

C8H17OH avatar Oct 27 '25 13:10 C8H17OH