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 Seznam Provider (seznam.cz) #10986

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/2_bug_provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ body:
- "Pipedrive"
- "Reddit"
- "Salesforce"
- "Seznam"
- "Slack"
- "Spotify"
- "Strava"
Expand Down
1 change: 1 addition & 0 deletions docs/public/img/providers/seznam.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions packages/core/src/providers/seznam.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/**
* <div style={{backgroundColor: "#000", display: "flex", justifyContent: "space-between", color: "#fff", padding: 16}}>
* <span>Built-in <b>Seznam.cz</b> integration.</span>
* <a href="https://vyvojari.seznam.cz/oauth">
* <img style={{display: "block"}} src="https://authjs.dev/img/providers/seznam.svg" height="48" width="48"/>
* </a>
* </div>
*
* @module providers/seznam
*/
import type { OAuthConfig, OAuthUserConfig } from "./index.js"

export interface SeznamProfile extends Record<string, any> {
accountDisplayName: string,
advert_user_id: string,
domain: string,
email: string,
email_verified: boolean,
firstname: string,
lastname: string,
oauth_user_id: string,
username: string,
}

/**
* Add Seznam.cz login to your page.
*
* ### Setup
*
* #### Callback URL
* ```
* https://example.com/api/auth/callback/seznam
* ```
*
* #### Configuration
*```js
* import Auth from "@auth/core"
* import Seznam from "@auth/core/providers/seznam"
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [
* Seznam({
* clientId: process.env.SEZNAM_CLIENT_ID,
* clientSecret: process.env.SEZNAM_CLIENT_SECRET,
* scope: "identity"
* })
* ],
* })
* ```
*
* ### Resources
*
* - [Seznam OAuth documentation](https://vyvojari.seznam.cz/oauth/doc?lang=en)
*
* ### Notes
*
*
* :::tip
* Seznam also returns a `email_verified` boolean property in the OAuth profile.
*
* You can use this property to restrict access to people with verified accounts at a particular domain.
*
* :::
*/
export default function Seznam<P extends SeznamProfile>(
options: OAuthUserConfig<P> & { scope?: string }
): OAuthConfig<P> {
return {
id: "seznam",
name: "Seznam",
type: "oauth",
authorization: {
url: "https://login.szn.cz/api/v1/oauth/auth",
params: {
scope: options.scope || "identity",
response_type: "code",
},
},
token: 'https://login.szn.cz/api/v1/oauth/token',
userinfo: 'https://login.szn.cz/api/v1/user',
client: {
token_endpoint_auth_method: 'client_secret_post'
},
checks: ['state'],

style: {
brandColor: '#CC0000',
},
options,
}
}
Loading