Skip to content
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

Add Minecraft provider #10265

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add Minecraft provider #10265

wants to merge 1 commit into from

Conversation

VortexHero
Copy link

@VortexHero VortexHero commented Mar 9, 2024

☕️ Reasoning

Adds a Minecraft provider based on Azure-AD. More information here: https://wiki.vg/Microsoft_Authentication_Scheme

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

Fixes: #4890

📌 Resources

Copy link

vercel bot commented Mar 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 9, 2024 5:51am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Mar 9, 2024 5:51am

Copy link

vercel bot commented Mar 9, 2024

@VortexHero is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

@Sithey
Copy link

Sithey commented Apr 5, 2024

Hello, i tried to use your Minecraft Provider but i have an issue after my login:

[next-auth][error][OAUTH_CALLBACK_ERROR] https://next-auth.js.org/errors#oauth_callback_error { error: Error at Object.request (webpack-internal:///(rsc)/./src/lib/minecraft.ts:189:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async oAuthCallback (webpack-internal:///(rsc)/./node_modules/next-auth/core/lib/oauth/callback.js:121:17) at async Object.callback (webpack-internal:///(rsc)/./node_modules/next-auth/core/routes/callback.js:52:11) at async AuthHandler (webpack-internal:///(rsc)/./node_modules/next-auth/core/index.js:208:28) at async NextAuthRouteHandler (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:69:28) at async NextAuth._args$ (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:105:16) at async C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:63809 at async eU.execute (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:53964) at async eU.handle (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:65062) at async doRender (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\base-server.js:1317:42) at async cacheEntry.responseCache.get.routeKind (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\base-server.js:1527:40) at async DevServer.renderToResponseWithComponentsImpl (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\base-server.js:1447:28) at async DevServer.renderPageComponent (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\base-server.js:1844:24) at async DevServer.renderToResponseImpl (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\base-server.js:1882:32) at async DevServer.pipeImpl (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\base-server.js:895:25) at async NextNodeServer.handleCatchallRenderRequest (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\next-server.js:269:17) at async DevServer.handleRequestImpl (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\base-server.js:791:17) at async C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\dev\next-dev-server.js:331:20 at async Span.traceAsyncFn (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\trace\trace.js:151:20) at async DevServer.handleRequest (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\dev\next-dev-server.js:328:24) at async invokeRender (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\lib\router-server.js:174:21) at async handleRequest (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\lib\router-server.js:353:24) at async requestHandlerImpl (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\lib\router-server.js:377:13) at async Server.requestListener (C:\Users\raphi\Documents\Dev\Web\Project\alphalya\node_modules\next\dist\server\lib\start-server.js:140:13) { name: 'OAuthCallbackError', code: undefined }, providerId: 'minecraft', message: '' }

When i am using the AzureAD Provider, all is working fine

Could you help me to fix this problem ?

I see that the probleme is due to minecraft.ok that return false

from https://api.minecraftservices.com/authentication/login_with_xbox

@Walidoux
Copy link

Walidoux commented Oct 15, 2024

@Sithey This is because there is no error handling for the scenario where minecraft.ok returns false, which inevitably leads to the execution of throw new Error() at the end of the request callback.

The reason for the falsy return value is :

According to this support Article, new created Azure Apps must apply for the Permission to use the Minecraft API using this form. If your App don't have the Permission api.minecraftservices.com will return a 403.

So in order to use the Minecraft provider that @VortexHero built, you have to submit an app registration request so they can approve it and add you to their allow list. You'll receive an email that will look like this :

Thank you for submitting your application for review. The assessment of recent application submissions has been completed, and we would like to inform you of the outcomes:

  • If your application adhered to the necessary criteria, it has been approved and added to our allow list.
  • Any reports on "bad apps" have been thoroughly verified, and appropriate actions, including blocking, have been taken accordingly.

The other way around is not use Azure App Active Directory but plain HTTP requests and some easy scrapping. I definitely don't recommend it since you'll have to add extra layers and complexity of code to verify 2FA user accounts and the list goes on.

Copy link

stale bot commented Jan 21, 2025

It looks like this issue did not receive any activity for 60 days. It will be closed in 7 days if no further activity occurs. If you think your issue is still relevant, commenting will keep it open. Thanks!

@stale stale bot added the stale Did not receive any activity for 60 days label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Refers to `@auth/core` examples providers stale Did not receive any activity for 60 days
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minecraft Authentication Provider
3 participants