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
1 change: 1 addition & 0 deletions docs/pages/data/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"freshbooks": "Freshbooks",
"fusionauth": "FusionAuth",
"gitlab": "GitLab",
"heavstal": "Heavstal",
"hubspot": "HubSpot",
"huggingface": "Hugging Face",
"identity-server4": "IdentityServer4",
Expand Down
47 changes: 47 additions & 0 deletions docs/pages/getting-started/providers/heavstal.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Callout } from "nextra/components"
import { Code } from "@/components/Code"

# Heavstal

Heavstal is a developer infrastructure platform providing secure OAuth2 and OpenID Connect (OIDC) identity services.

## Resources

- [Heavstal Developer Console](https://heavstal-tech.vercel.app/oauth/apps)
- [Heavstal Documentation](https://heavstal-tech.vercel.app/docs/api/oauth-guide)

## Setup

### Callback URL

<Code>
<CopyButton />
<span className="code-block">https://example.com/api/auth/callback/heavstal</span>
</Code>

### Environment Variables

<Callout type="info">
Heavstal supports OIDC discovery. You do not need to configure endpoints manually.
</Callout>

```env filename=".env"
AUTH_HEAVSTAL_ID=ht_id_...
AUTH_HEAVSTAL_SECRET=ht_secret_...
```

### Configuration

<Code>
<CopyButton />
```ts filename="auth.ts"
import NextAuth from "next-auth"
import Heavstal from "next-auth/providers/heavstal"

export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [
Heavstal
],
})
```
</Code>
5 changes: 5 additions & 0 deletions docs/public/img/providers/heavstal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions packages/core/src/providers/heavstal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import type { OAuthConfig, OAuthUserConfig } from "../types.js"

/**
* The returned user profile from Heavstal Tech.
*/
export interface HeavstalProfile extends Record<string, any> {
/** The unique Heavstal User ID */
sub: string
/** The user's public display name */
name: string
/** The user's verified email address */
email: string
/** The user's profile picture URL */
picture: string
}

/**
* Add Heavstal login to your page.
*
* ### Setup
*
* #### Callback URL
* ```
* https://example.com/api/auth/callback/heavstal
* ```
*
* #### Configuration
*```ts
* import { Auth } from "@auth/core"
* import Heavstal from "@auth/core/providers/heavstal"
*
* const request = new Request("https://example.com")
* const response = await Auth(request, {
* providers: [
* Heavstal({
* clientId: process.env.HEAVSTAL_CLIENT_ID,
* clientSecret: process.env.HEAVSTAL_CLIENT_SECRET,
* }),
* ],
* })
* ```
*
* ### Resources
*
* - [Heavstal Developer Console](https://heavstal-tech.vercel.app/oauth/apps)
* - [Heavstal API Documentation](https://heavstal-tech.vercel.app/docs/api/oauth-guide)
*/
export default function Heavstal(
options: OAuthUserConfig<HeavstalProfile>
): OAuthConfig<HeavstalProfile> {
return {
id: "heavstal",
name: "Heavstal",
type: "oidc",
issuer: "https://accounts-heavstal.vercel.app",
style: {
logo: "/providers/heavstal.svg",
bg: "#000",
text: "#fff",
},
profile(profile) {
return {
id: profile.sub,
name: profile.name,
email: profile.email,
image: profile.picture,
}
},
options,
}
}