Skip to content
Draft
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
2 changes: 2 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

### Added

- Added the `Instagram` OAuth provider to the supported integrations in Aura Auth. [#209](https://github.com/aura-stack-ts/auth/pull/209)

- Added the `Authentik` OpenID Connect provider, enabling authentication through Authentik accounts with minimal configuration. [#199](https://github.com/aura-stack-ts/auth/pull/199)

- Added the `Hugging Face` OpenID Connect provider, enabling authentication through Hugging Face accounts with minimal configuration. [#198](https://github.com/aura-stack-ts/auth/pull/198)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/oauth/huggingface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ export const huggingface = <DefaultUser extends User = User>(
}) as DefaultUser,
...options,
}
}
}
50 changes: 50 additions & 0 deletions packages/core/src/oauth/instagram.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import type { OAuthProviderCredentials, User } from "@/@types/index.ts"

/**
* @see [Instagram - Me Fields](https://developers.facebook.com/documentation/instagram-platform/instagram-api-with-instagram-login/get-started#fields)
*/
export interface InstagramProfile {
id: string
user_id: string
username: string
name?: string
account_type?: string
profile_picture_url?: string
followers_count?: number
follows_count?: number
media_count?: number
}

/**
* Instagram OAuth Provider
*
* @see [Instagram - Create an App](https://developers.facebook.com/documentation/development/create-an-app)
* @see [Instagram - OAuth authorize](https://developers.facebook.com/documentation/instagram-platform/reference/oauth-authorize)
* @see [Instagram - OAuth Access Token](https://developers.facebook.com/documentation/instagram-platform/reference/access_token)
* @see [Instagram - Refresh Access Token](https://developers.facebook.com/documentation/instagram-platform/reference/refresh_access_token)
* @see [Instagram - Me Fields](https://developers.facebook.com/documentation/instagram-platform/instagram-api-with-instagram-login/get-started#fields)
*/
export const instagram = <DefaultUser extends User = User>(
options?: Partial<OAuthProviderCredentials<InstagramProfile, DefaultUser>>
): OAuthProviderCredentials<InstagramProfile, DefaultUser> => {
return {
id: "instagram",
name: "Instagram",
authorize: {
url: "https://api.instagram.com/oauth/authorize",
params: {
scope: "instagram_business_basic",
},
},
accessToken: "https://api.instagram.com/oauth/access_token",
userInfo: "https://graph.instagram.com/v25.0/me?fields=id,username,email,profile_picture_url",
profile: (profile) =>
({
sub: profile.id.toString(),
name: profile.username,
email: null,
image: profile.profile_picture_url,
}) as DefaultUser,
...options,
}
}
Loading