arffornia/minecraft-oauth
Composer 安装命令:
composer require arffornia/minecraft-oauth
包简介
Fork from aberdeener, updated to php8 for laravel11 compatibility, provides easy layer to get a Minecraft profile from a Microsoft Live OAuth session
README 文档
README
Forked from tadhgboyle.
Updated by TheGostsniperfr for PHP 8 and Laravel 11 support.
Provides easy layer to get a Minecraft profile (UUID, username, skins, capes) from a Microsoft Live OAuth session.
Usage
You have different solutions for creating the request, here's one that works.
In addition, you'll need to register your Azure app with Mojang for your app to be authorized to use the Mojang api, otherwise you'll get a 403 error code by Mojang API.
To do this, you need to fill in this form (response within a few weeks)
Create MS request
$clientId = 'AZURE_OAUTH_CLIENT_ID'; $redirectUri = urlencode('REDIRECT_URI'); $authUrl = "https://login.live.com/oauth20_authorize.srf?client_id=$clientId&response_type=code&redirect_uri=$redirectUri&scope=XboxLive.signin%20offline_access&state=NOT_NEEDED";
Nb: Apparently, it's possible to use service::user.auth.xboxlive.com::MBI_SSL as a scope to avoid confirming microsoft permissions.
Unfortunately, I haven't had any conclusive results on this, so if you have any information on this subject, I'd be delighted to have it.
Receive MS responce
require 'vendor/autoload.php'; $client_id = '<Azure OAuth Client ID>'; $client_secret = '<Azure OAuth Client Secret>'; $redirect_uri = '<URL to this file>'; try { $profile = (new \Arffornia\MinecraftOauth\MinecraftOauth)->fetchProfile( $client_id, $client_secret, $_GET['code'], $redirect_uri, ); } catch (\Arffornia\MinecraftOauth\Exceptions\MinecraftOauthException $e) { echo $e->getMessage(); } echo 'Minecraft UUID: ' . $profile->uuid(); echo 'Minecraft Username: ' . $profile->username(); echo 'Minecraft Skin URL: ' . $profile->skins()[0]->url(); echo 'Minecraft Cape URL: ' . $profile->capes()[0]->url();
Info
If you want to check all the MS Auth Scheme.
arffornia/minecraft-oauth 适用场景与选型建议
arffornia/minecraft-oauth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 81 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 arffornia/minecraft-oauth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arffornia/minecraft-oauth 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 81
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-20