Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Wechat Service Account

Wechat Service Account Laravel Package

socialiteproviders/wechat-service-account

This Laravel Socialite provider adds WeChat Service Account (Official Account) OAuth login to your app. Configure your WeChat App ID and secret, then authenticate users through the standard Socialite driver—ideal for Chinese-market apps that need WeChat sign-in.

View on GitHub
Deep Wiki
Context7

[READ ONLY] Subtree split of the SocialiteProviders/WeChatServiceAccount Provider (see SocialiteProviders/Providers)

Frequently asked questions about Wechat Service Account
How do I install and register socialiteproviders/wechat-service-account in Laravel?
Install it with Composer using composer require socialiteproviders/wechat-service-account. Register the SocialiteProviders Manager service provider if your app does not already use it, then add the SocialiteWasCalled listener for the WeChatServiceAccount provider. After that, add a wechat_service_account entry to config/services.php with your App ID, secret, and redirect URI. You then call Socialite::driver('wechat_service_account')->redirect() like any other Socialite driver.
Does this package support Laravel 10, Laravel 11, and PHP 8?
That is not confirmed by the package context. The last release was December 2020, and a provider of that vintage very likely pins socialiteproviders/manager ^3.0 and Socialite ^4.0, which may not resolve against Laravel 10 or 11 without Composer constraint changes. There is no CI evidence in the context showing PHP 8.x or Laravel 9+ support. Treat Laravel 10/11 compatibility as something you must verify in a fork before committing.
What is the difference between snsapi_base and snsapi_userinfo in WeChat OAuth?
snsapi_base performs silent authorization and returns only the user's openid, so it is useful for identifying a returning WeChat user without a consent screen. snsapi_userinfo shows an explicit consent screen and then lets you fetch profile details such as nickname and avatar. Choose based on whether your product needs profile data at login or only a stable WeChat identifier.
How do I get a WeChat unionid with this Service Account provider?
WeChat returns unionid only when the Official Account is bound to a WeChat Open Platform account. That is a business and WeChat console configuration dependency, not something this Laravel package can enable in code. If your product needs to join identities across web, Official Account, and other WeChat channels, confirm the Open Platform binding before you design the users table. Otherwise you may only receive openid and your cross-channel identity model will not work.
Why does WeChat login sometimes succeed but return a user with null fields?
WeChat can return OAuth errors as HTTP 200 with a JSON errcode and errmsg envelope, so Socialite's throw() idiom will not fire. If the provider does not explicitly inspect errcode, a failed token exchange can silently map to a user object with null fields. This is the highest-severity defect class to check in a fork. Verify the driver checks errcode at both the token and userinfo steps before relying on it in production.
Which WeChat OAuth flow does this package cover: Official Account, Open Platform, Enterprise WeChat, or Mini Program?
This package is for WeChat Service Account, also called Official Account, web authorization. It is not the WeChat Open Platform website or QR login provider, not Enterprise WeChat, and not Mini Program login. Those are four distinct OAuth flows and usually require different packages. Confirm which WeChat entity is in scope before integrating, because choosing the wrong one wastes the entire effort.
How is WeChat OAuth non-standard, and can Laravel Socialite handle it?
WeChat's flow is not OAuth spec-compliant in ways that matter to Socialite. The token endpoint is a GET with query parameters while Socialite defaults to a POST form-encoded request, the authorize URL must be suffixed with #wechat_redirect, and the userinfo endpoint requires openid alongside the access token. A provider doing this must override base-class internals such as getAccessTokenResponse, which is the most fragile surface across Socialite minor releases. Test upgrades carefully if you fork or maintain this driver.
How do I configure the WeChat App ID, secret, and redirect URI in Laravel?
Add a driver entry such as wechat_service_account in config/services.php with client_id, client_secret, and redirect values, preferably read from environment variables. In the WeChat Official Account console, configure the authorized callback domain to match your redirect host, and make sure the account is verified because unverified subscription accounts cannot perform 网页授权. Then use the standard Socialite redirect and callback flow in your controller.
Is socialiteproviders/wechat-service-account actively maintained and safe for production?
The context shows weak maintenance signals: 4 stars, 0 dependents, and a last release in December 2020. There is no CI evidence of modern PHP or Laravel support and effectively a bus factor of zero on this specific driver. The SocialiteProviders organization provides some continuity, but this provider is not on a critical path, so you would be the only party to notice a break. For production, plan to fork and pin it, or compare the cost against roughly 150 lines of first-party OAuth code.
How can I test WeChat Service Account OAuth in Laravel without a real WeChat user?
Mock the Socialite driver or fake the HTTP responses from the token and userinfo endpoints, including WeChat's HTTP 200 errcode error envelopes. Use a WeChat Official Account test account where possible to exercise the real redirect and scope behavior. Write tests for snsapi_base openid-only responses, snsapi_userinfo profile responses, missing unionid, and errcode failures. That will catch the silent-null-user failure mode before it reaches production.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core