Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference
wechat

providers/wechat

Built-in WeChat integration.

WeChatProfile

See

Get the authenticated user

Indexable

[claim: string]: unknown

Properties

city

city: string;

country

country: string;

headimgurl

headimgurl: string;

nickname

nickname: string;

openid

openid: string;

privilege

privilege: string[];

province

province: string;

sex

sex: number;

unionid

unionid: string;

default()

default(options): OAuthConfig<WeChatProfile>

Add WeChat login to your page and make requests to WeChat APIs.

Setup

Callback URL

https://example.com/api/auth/callback/wechat

Configuration

import { Auth } from "@auth/core"
import WeChat from "@auth/core/providers/wechat"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [WeChat({
    clientId: AUTH_WECHAT_APP_ID,
    clientSecret: AUTH_WECHAT_APP_SECRET,
    platformType: "OfficialAccount",
  })],
})

Resources

💡

The WeChat provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider.

Disclaimer If you think you found a bug in the default configuration, you can open an issue.

Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions.

Parameters

ParameterType
optionsOAuthUserConfig<WeChatProfile> & { platformType: "OfficialAccount" | "WebsiteApp"; }

Returns

OAuthConfig<WeChatProfile>

Auth.js © Balázs Orbán and Team - 2024