{"id":21963007,"url":"https://github.com/alphabs/xboxauthnet","last_synced_at":"2025-04-23T22:27:57.256Z","repository":{"id":37839942,"uuid":"320889523","full_name":"AlphaBs/XboxAuthNet","owner":"AlphaBs","description":"Xbox Live authentication","archived":false,"fork":false,"pushed_at":"2025-01-06T15:10:10.000Z","size":228,"stargazers_count":13,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T22:19:39.238Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlphaBs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-12T17:47:39.000Z","updated_at":"2025-04-22T03:39:22.000Z","dependencies_parsed_at":"2024-08-24T03:39:16.344Z","dependency_job_id":"8ee037f8-8142-4f31-a6d2-a5ece9fe38b8","html_url":"https://github.com/AlphaBs/XboxAuthNet","commit_stats":{"total_commits":65,"total_committers":2,"mean_commits":32.5,"dds":"0.12307692307692308","last_synced_commit":"226fc1ebb617aee6d041733d211d9f21f3987249"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaBs%2FXboxAuthNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaBs%2FXboxAuthNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaBs%2FXboxAuthNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlphaBs%2FXboxAuthNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlphaBs","download_url":"https://codeload.github.com/AlphaBs/XboxAuthNet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250525658,"owners_count":21445067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T10:58:45.778Z","updated_at":"2025-04-23T22:27:57.239Z","avatar_url":"https://github.com/AlphaBs.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XboxAuthNet\n\nMicrosoft OAuth 2.0 and Xbox Authentication\n\n## Features\n\n- [Microsoft OAuth Code Flow](https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow)\n- Xbox Authentication\n- Xbox Sisu Authentication with Proof-of-Possession\n\n## Install\n\n![Install nuget package XboxAuthNet](https://img.shields.io/nuget/v/XboxAuthNet?label=XboxAuthNet\u0026style=flat-square)\n\n[XboxAuthNet](https://www.nuget.org/packages/XboxAuthNet)\n\n## Usage: Microsoft OAuth\n\nCurrently only [auth code flow](https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow) is supported. \n\n```csharp\n// Initialize API client\nvar httpClient = new HttpClient();\nvar apiClient = new MicrosoftOAuthCodeApiClient(\"\u003cCLIENT-ID\u003e\", \"\u003cSCOPES\u003e\", httpClient); // replace \"SCOPES\" to XboxAuth.XboxScope for Xbox Authentication\n\n// Authenticate with auth code flow\nvar codeFlow = new MicrosoftOAuthCodeFlowBuilder(apiClient)\n    .Build();\nMicrosoftOAuthResponse result = await codeFlow.Authenticate();\n\n// `result.AccessToken` can be used on Xbox Authentication\n// store `result` variable to refresh token later.\n// `MicrosoftOAuthResponse` can be serialized (like json)\nConsole.WriteLine(result.AccessToken);\nConsole.WriteLine(result.RefreshToken);\n```\n\n### Refresh Microsoft OAuth Token\n```csharp\nif (!result.Validate())\n{\n    var newResult = await apiClient.RefreshToken(result.RefreshToken, CancellationToken.None);\n    Console.WriteLine(newResult.AccessToken);\n    Console.WriteLine(newResult.RefreshToken);\n}\n```\n\n## Usage: Xbox Authentication\n\nThere are three Xbox authentication methods. You can find a description of each method [here](https://github.com/AlphaBs/XboxAuthNet/wiki/).\n\n### Xbox Basic Authentication\n\n```csharp\nvar httpClient = new HttpClient();\nvar xboxAuthClient = new XboxAuthClient(httpClient);\n\nvar userToken = await xboxAuthClient.RequestUserToken(\"\u003cmicrosoft_oauth2_access_token\u003e\");\nvar xsts = await xboxAuthClient.RequestXsts(userToken.Token, \"\u003crelying_party\u003e\");\n\nConsole.WriteLine(xsts.Token);\n```\n\n### Xbox Full Authentication\n```csharp\nvar httpClient = new HttpClient();\nvar xboxAuthClient = new XboxAuthClient(httpClient);\n\nvar userToken = await xboxAuthClient.RequestSignedUserToken(new XboxSignedUserTokenRequest\n{\n    AccessToken = \"\u003cmicrosoft_oauth2_access_token\u003e\",\n    TokenPrefix = AbstractXboxAuthRequest.XboxTokenPrefix\n});\nvar deviceToken = await xboxAuthClient.RequestDeviceToken(new XboxDeviceTokenRequest\n{\n    DeviceType = XboxDeviceTypes.Nintendo,\n    DeviceVersion = \"0.0.0\"\n});\nvar titleToken = await xboxAuthClient.RequestTitleToken(new XboxTitleTokenRequest\n{\n    AccessToken = \"\u003cmicrosoft_oauth2_access_token\u003e\",\n    DeviceToken = deviceToken.Token\n});\nvar xsts = await xboxAuthClient.RequestXsts(new XboxXstsRequest\n{\n    UserToken = userToken.Token,\n    DeviceToken = deviceToken.Token,\n    TitleToken = titleToken.Token,\n    RelyingParty = \"\u003crelying_party\u003e\"\n});\n\nConsole.WriteLine(xsts.Token);\n```\n\n### Xbox Sisu Authentication\n```csharp\nvar httpClient = new HttpClient();\nvar xboxAuthClient = new XboxAuthClient(httpClient);\n\nvar deviceToken = await xboxAuthClient.RequestDeviceToken(XboxDeviceTypes.Win32, \"0.0.0\");\nvar sisuResult = await xboxAuthClient.SisuAuth(new XboxSisuAuthRequest\n{\n    AccessToken = \"\u003cmicrosoft_oauth2_access_token\u003e\",\n    ClientId = XboxGameTitles.MinecraftJava,\n    DeviceToken = deviceToken.Token,\n    RelyingParty = \"\u003crelying_party\u003e\"\n});\n\nConsole.WriteLine(xsts.Token);\n```\n\n## Example\n\n[Example project](/example/WinForm)\n\n## References\n\nThese documents explain how Microsoft OAuth 2.0 works.\n\n[Microsoft OAuth 2.0](https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow)\n\n[Desktop application calling a web api](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/scenarios#desktop-application-calling-a-web-api-in-the-name-of-the-signed-in-user) (XboxAuthNet implements [interactive authentication](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Acquiring-tokens-interactively))\n\nThis project was made possible thanks to the contributions of various open-source projects. not used any document from [NDA developer program](https://learn.microsoft.com/en-us/gaming/gdk/_content/gc/getstarted/gc-getstarted-toc)\n\n[MSAL.NET](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet)\n\n[xbox-live-api](https://github.com/microsoft/xbox-live-api)\n\n[xboxlive-auth](https://github.com/XboxReplay/xboxlive-auth)\n\n[prismarine-auth](https://github.com/PrismarineJS/prismarine-auth)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphabs%2Fxboxauthnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falphabs%2Fxboxauthnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphabs%2Fxboxauthnet/lists"}