Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/docs/providers/mezon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
id: mezon
title: Mezon
---

## Documentation

https://mezon.ai/docs/developer/mezon-topics/oauth2

## Configuration

https://mezon.ai/developers/dashboard

## Options

The **Mezon Provider** comes with a set of default options:

- [Mezon Provider options](https://github.com/nextauthjs/next-auth/blob/v4/packages/next-auth/src/providers/mezon.ts)

You can override any of the options to suit your own use case.

## Example

```js
import MezonProvider from "next-auth/providers/mezon"
...
providers: [
MezonProvider({
clientId: process.env.MEZON_CLIENT_ID,
clientSecret: process.env.MEZON_CLIENT_SECRET
})
}
...
```
42 changes: 42 additions & 0 deletions packages/next-auth/src/providers/mezon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import type { OAuthConfig, OAuthUserConfig } from "."

export interface MezonProfile extends Record<string, any> {
user_id: string;
email: string;
display_name?: string;
avatar?: string;
mezon_id: string;
sub: string;
username: string;
}

export default function Mezon<P extends MezonProfile>(
options: OAuthUserConfig<P>
): OAuthConfig<P> {
return {
id: "mezon",
name: "Mezon",
type: "oauth",
wellKnown: "https://oauth2.mezon.ai/.well-known/openid-configuration",
authorization: {
url: "https://oauth2.mezon.ai/oauth2/auth",
params: {
scope: "offline openid",
},
},
token: "https://oauth2.mezon.ai/oauth2/token",
userinfo: "https://oauth2.mezon.ai/userinfo",
profile(profile) {
return {
id: profile.user_id,
name: profile?.display_name ?? profile?.username,
email: profile.email,
image: profile?.avatar,
}
},
client: {
token_endpoint_auth_method: "client_secret_post",
},
options
};
}