Compare commits

...

10 Commits

Author SHA1 Message Date
Balázs Orbán
0cbeb4055e chore(release): bump version 2023-01-24 14:03:59 +01:00
Balázs Orbán
5a128db369 fix(providers): add slash to default logo urls
fixes #6495
2023-01-24 14:03:40 +01:00
Balázs Orbán
c385cf8c7c chore(release): bump version [skip ci] 2023-01-24 02:47:03 +01:00
Balázs Orbán
53fa46744c chore: match core 2023-01-24 02:40:29 +01:00
StachowiakDawid
451eaaabd2 fix: Allow adding own logo to provider (#6465) 2023-01-24 02:35:30 +01:00
Balázs Orbán
f54424c216 fix(next-auth): remove engines 2023-01-24 02:24:45 +01:00
Balázs Orbán
09bcc1d504 fix(providers): default image to null for Azure AD
Fixes #6482
2023-01-24 02:24:35 +01:00
Chiemerie Arum
6ecf9cb93d docs(client): Improve grammar (#6444)
Improve grammar
2023-01-20 11:14:40 +00:00
Judicael
ba2711d279 docs: Remove Demo Identity server 4 (#6354)
Since the demo is not working anymore (removed), we should remove the demo identity server from the docs
2023-01-10 12:05:59 +00:00
Balázs Orbán
03881bf98f chore: fix sync GH Action pat 2023-01-07 08:29:07 +01:00
37 changed files with 99 additions and 119 deletions

View File

@@ -14,5 +14,5 @@ jobs:
# Can update to v1 when https://github.com/BetaHuhn/repo-file-sync-action/issues/168 is resolved
uses: BetaHuhn/repo-file-sync-action@v1.16.5
with:
GH_PAT: ${{ secrets.SYNC_EXAMPLE_PAT }}
GH_PAT: ${{ secrets.GH_PAT_CLASSIC }}
SKIP_PR: true

View File

@@ -65,7 +65,7 @@ export default function Component() {
### Require session
Due to the way how Next.js handles `getServerSideProps` and `getInitialProps`, every protected page load has to make a server-side request to check if the session is valid and then generate the requested page (SSR). This increases server load, and if you are good with making the requests from the client, there is an alternative. You can use `useSession` in a way that makes sure you always have a valid session. If after the initial loading state there was no session found, you can define the appropriate action to respond.
Due to the way Next.js handles `getServerSideProps` and `getInitialProps`, every protected page load has to make a server-side request to check if the session is valid and then generate the requested page (SSR). This increases server load, and if you are good with making the requests from the client, there is an alternative. You can use `useSession` in a way that makes sure you always have a valid session. If after the initial loading state there was no session found, you can define the appropriate action to respond.
The default behavior is to redirect the user to the sign-in page, from where - after a successful login - they will be sent back to the page they started on. You can also define an `onUnauthenticated()` callback, if you would like to do something else:

View File

@@ -35,27 +35,3 @@ providers: [
]
...
```
## Demo IdentityServer
The configuration below is for the demo server at https://demo.identityserver.io/
If you want to try it out, you can copy and paste the configuration below.
You can sign in to the demo service with either <b>bob/bob</b> or <b>alice/alice</b>.
```js
import IdentityServer4Provider from `next-auth/providers/identity-server4`
...
providers: [
IdentityServer4Provider({
id: "demo-identity-server",
name: "Demo IdentityServer4",
authorization: { params: { scope: "openid profile email api offline_access" } },
issuer: "https://demo.identityserver.io/",
clientId: "interactive.confidential",
clientSecret: "secret",
})
}
...
```

View File

@@ -1,6 +1,6 @@
{
"name": "next-auth",
"version": "4.18.8",
"version": "4.18.10",
"description": "Authentication for Next.js",
"homepage": "https://next-auth.js.org",
"repository": "https://github.com/nextauthjs/next-auth.git",
@@ -127,8 +127,5 @@
"react": "^18",
"react-dom": "^18",
"whatwg-fetch": "^3.6.2"
},
"engines": {
"node": "^12.19.0 || ^14.15.0 || ^16.13.0 || ^18.12.0"
}
}

View File

@@ -74,6 +74,7 @@ export default function SigninPage(props: SignInServerPageParams) {
const error = errorType && (errors[errorType] ?? errors.default)
const logos = "https://authjs.dev/img/providers"
return (
<div className="signin">
{theme.brandColor && (
@@ -117,14 +118,24 @@ export default function SigninPage(props: SignInServerPageParams) {
>
{provider.style?.logo && (
<img
loading="lazy"
height={24}
width={24}
id="provider-logo"
src={`https://authjs.dev/img/providers/${provider.style.logo}`}
src={`${
provider.style.logo.startsWith("/") ? logos : ""
}${provider.style.logo}`}
/>
)}
{provider.style?.logoDark && (
<img
loading="lazy"
height={24}
width={24}
id="provider-logo-dark"
src={`https://authjs.dev/img/providers/${provider.style.logoDark}`}
src={`${
provider.style.logo.startsWith("/") ? logos : ""
}${provider.style.logoDark}`}
/>
)}
<span>Sign in with {provider.name}</span>

View File

@@ -118,8 +118,8 @@ export default function Apple<P extends AppleProfile>(
},
checks: ["pkce"],
style: {
logo: "apple.svg",
logoDark: "apple-dark.svg",
logo: "/apple.svg",
logoDark: "/apple-dark.svg",
bg: "#fff",
text: "#000",
bgDark: "#000",

View File

@@ -32,8 +32,8 @@ export default function Atlassian<P extends AtlassianProfile>(
}
},
style: {
logo: "atlassian.svg",
logoDark: "atlassian-dark.svg",
logo: "/atlassian.svg",
logoDark: "/atlassian-dark.svg",
bg: "#0052cc",
text: "#fff",
bgDark: "#fff",

View File

@@ -27,8 +27,8 @@ export default function Auth0<P extends Auth0Profile>(
}
},
style: {
logo: "auth0.svg",
logoDark: "auth0-dark.svg",
logo: "/auth0.svg",
logoDark: "/auth0-dark.svg",
bg: "#fff",
text: "#EB5424",
bgDark: "#EB5424",

View File

@@ -43,8 +43,8 @@ export default function AzureADB2C<P extends AzureB2CProfile>(
}
},
style: {
logo: "azure.svg",
logoDark: "azure-dark.svg",
logo: "/azure.svg",
logoDark: "/azure-dark.svg",
bg: "#fff",
text: "#0072c6",
bgDark: "#0072c6",

View File

@@ -33,36 +33,32 @@ export default function AzureAD<P extends AzureADProfile>(
},
async profile(profile, tokens) {
// https://docs.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0#examples
const profilePicture = await fetch(
const response = await fetch(
`https://graph.microsoft.com/v1.0/me/photos/${profilePhotoSize}x${profilePhotoSize}/$value`,
{
headers: {
Authorization: `Bearer ${tokens.access_token}`,
},
}
{ headers: { Authorization: `Bearer ${tokens.access_token}` } }
)
// Confirm that profile photo was returned
if (profilePicture.ok) {
const pictureBuffer = await profilePicture.arrayBuffer()
const pictureBase64 = Buffer.from(pictureBuffer).toString("base64")
return {
id: profile.sub,
name: profile.name,
email: profile.email,
image: `data:image/jpeg;base64, ${pictureBase64}`,
}
} else {
return {
id: profile.sub,
name: profile.name,
email: profile.email,
}
let image
// TODO: Do this without Buffer
if (response.ok && typeof Buffer !== "undefined") {
try {
const pictureBuffer = await response.arrayBuffer()
const pictureBase64 = Buffer.from(pictureBuffer).toString("base64")
image = `data:image/jpeg;base64, ${pictureBase64}`
} catch {}
}
return {
id: profile.sub,
name: profile.name,
email: profile.email,
image: image ?? null,
}
},
style: {
logo: "azure.svg",
logoDark: "azure-dark.svg",
logo: "/azure.svg",
logoDark: "/azure-dark.svg",
bg: "#fff",
text: "#0072c6",
bgDark: "#0072c6",

View File

@@ -27,8 +27,8 @@ export default function BattleNet<P extends BattleNetProfile>(
}
},
style: {
logo: "battlenet.svg",
logoDark: "battlenet-dark.svg",
logo: "/battlenet.svg",
logoDark: "/battlenet-dark.svg",
bg: "#fff",
text: "#148eff",
bgDark: "#148eff",

View File

@@ -16,8 +16,8 @@ export default function Box(options) {
}
},
style: {
logo: "box.svg",
logoDark: "box-dark.svg",
logo: "/box.svg",
logoDark: "/box-dark.svg",
bg: "#fff",
text: "#0075C9",
bgDark: "#0075C9",

View File

@@ -25,8 +25,8 @@ export default function Cognito<P extends CognitoProfile>(
}
},
style: {
logo: "cognito.svg",
logoDark: "cognito.svg",
logo: "/cognito.svg",
logoDark: "/cognito.svg",
bg: "#fff",
text: "#C17B9E",
bgDark: "#fff",

View File

@@ -45,8 +45,8 @@ export default function Discord<P extends DiscordProfile>(
}
},
style: {
logo: "discord.svg",
logoDark: "discord-dark.svg",
logo: "/discord.svg",
logoDark: "/discord-dark.svg",
bg: "#fff",
text: "#7289DA",
bgDark: "#7289DA",

View File

@@ -42,8 +42,8 @@ export default function Facebook<P extends FacebookProfile>(
}
},
style: {
logo: "facebook.svg",
logoDark: "facebook-dark.svg",
logo: "/facebook.svg",
logoDark: "/facebook-dark.svg",
bg: "#fff",
text: "#006aff",
bgDark: "#006aff",

View File

@@ -51,8 +51,8 @@ export default function Foursquare(options) {
}
},
style: {
logo: "foursquare.svg",
logoDark: "foursquare-dark.svg",
logo: "/foursquare.svg",
logoDark: "/foursquare-dark.svg",
bg: "#fff",
text: "#000",
bgDark: "#000",

View File

@@ -18,8 +18,8 @@ export default function Freshbooks(options) {
}
},
style: {
logo: "freshbooks.svg",
logoDark: "freshbooks-dark.svg",
logo: "/freshbooks.svg",
logoDark: "/freshbooks-dark.svg",
bg: "#fff",
text: "#0075dd",
bgDark: "#0075dd",

View File

@@ -99,8 +99,8 @@ export default function Github<P extends GithubProfile>(
}
},
style: {
logo: "github.svg",
logoDark: "github-dark.svg",
logo: "/github.svg",
logoDark: "/github-dark.svg",
bg: "#fff",
bgDark: "#000",
text: "#000",

View File

@@ -68,8 +68,8 @@ export default function GitLab<P extends GitLabProfile>(
}
},
style: {
logo: "gitlab.svg",
logoDark: "gitlab-dark.svg",
logo: "/gitlab.svg",
logoDark: "/gitlab-dark.svg",
bg: "#fff",
text: "#FC6D26",
bgDark: "#FC6D26",

View File

@@ -38,8 +38,8 @@ export default function Google<P extends GoogleProfile>(
}
},
style: {
logo: "google.svg",
logoDark: "google.svg",
logo: "/google.svg",
logoDark: "/google.svg",
bgDark: "#fff",
bg: "#fff",
text: "#000",

View File

@@ -65,8 +65,8 @@ export default function HubSpot<P extends HubSpotProfile>(
}
},
style: {
logo: "hubspot.svg",
logoDark: "hubspot-dark.svg",
logo: "/hubspot.svg",
logoDark: "/hubspot-dark.svg",
bg: "#fff",
text: "#ff7a59",
bgDark: "#ff7a59",

View File

@@ -47,8 +47,8 @@ export default function Instagram(options) {
}
},
style: {
logo: "instagram.svg",
logoDark: "instagram.svg",
logo: "/instagram.svg",
logoDark: "/instagram.svg",
bg: "#fff",
text: "#000",
bgDark: "#fff",

View File

@@ -44,8 +44,8 @@ export default function Keycloak<P extends KeycloakProfile>(
}
},
style: {
logo: "keycloak.svg",
logoDark: "keycloak.svg",
logo: "/keycloak.svg",
logoDark: "/keycloak.svg",
bg: "#fff",
text: "#000",
bgDark: "#fff",

View File

@@ -34,8 +34,8 @@ export default function LINE<P extends LineProfile>(
id_token_signed_response_alg: "HS256",
},
style: {
logo: "line.svg",
logoDark: "line.svg",
logo: "/line.svg",
logoDark: "/line.svg",
bg: "#fff",
text: "#00C300",
bgDark: "#00C300",

View File

@@ -56,8 +56,8 @@ export default function LinkedIn<P extends LinkedInProfile>(
}
},
style: {
logo: "linkedin.svg",
logoDark: "linkedin-dark.svg",
logo: "/linkedin.svg",
logoDark: "/linkedin-dark.svg",
bg: "#fff",
text: "#069",
bgDark: "#069",

View File

@@ -16,8 +16,8 @@ export default function Mailchimp(options) {
}
},
style: {
logo: "mailchimp.svg",
logoDark: "mailchimp-dark.svg",
logo: "/mailchimp.svg",
logoDark: "/mailchimp-dark.svg",
bg: "#fff",
text: "#000",
bgDark: "#000",

View File

@@ -53,8 +53,8 @@ export default function Okta<P extends OktaProfile>(
}
},
style: {
logo: "okta.svg",
logoDark: "okta-dark.svg",
logo: "/okta.svg",
logoDark: "/okta-dark.svg",
bg: "#fff",
text: "#000",
bgDark: "#000",

View File

@@ -30,8 +30,8 @@ export default function Patreon<P extends PatreonProfile>(
}
},
style: {
logo: "patreon.svg",
logoDark: "patreon.svg",
logo: "/patreon.svg",
logoDark: "/patreon.svg",
bg: "#fff",
text: "#e85b46",
bgDark: "#000",

View File

@@ -50,8 +50,8 @@ export default function Slack<P extends SlackProfile>(
}
},
style: {
logo: "slack.svg",
logoDark: "slack.svg",
logo: "/slack.svg",
logoDark: "/slack.svg",
bg: "#fff",
text: "#000",
bgDark: "#000",

View File

@@ -30,8 +30,8 @@ export default function Spotify<P extends SpotifyProfile>(
}
},
style: {
logo: "spotify.svg",
logoDark: "spotify.svg",
logo: "/spotify.svg",
logoDark: "/spotify.svg",
bg: "#fff",
text: "#2ebd59",
bgDark: "#fff",

View File

@@ -54,8 +54,8 @@ export default function TodoistProvider<P extends TodoistProfile>(
}
},
style: {
logo: "todoist.svg",
logoDark: "todoist.svg",
logo: "/todoist.svg",
logoDark: "/todoist.svg",
bg: "#fff",
text: "#E44332",
bgDark: "#000",

View File

@@ -52,8 +52,8 @@ export default function Trakt<P extends TraktUser>(
}
},
style: {
logo: "trakt.svg",
logoDark: "trakt-dark.svg",
logo: "/trakt.svg",
logoDark: "/trakt-dark.svg",
bg: "#fff",
text: "#ED2224",
bgDark: "#ED2224",

View File

@@ -37,8 +37,8 @@ export default function Twitch<P extends TwitchProfile>(
}
},
style: {
logo: "twitch.svg",
logoDark: "twitch-dark.svg",
logo: "/twitch.svg",
logoDark: "/twitch-dark.svg",
bg: "#fff",
text: "#65459B",
bgDark: "#65459B",

View File

@@ -120,8 +120,8 @@ export function TwitterLegacy<
}
},
style: {
logo: "twitter.svg",
logoDark: "twitter-dark.svg",
logo: "/twitter.svg",
logoDark: "/twitter-dark.svg",
bg: "#fff",
text: "#1da1f2",
bgDark: "#1da1f2",
@@ -215,8 +215,8 @@ export default function Twitter<
},
checks: ["pkce", "state"],
style: {
logo: "twitter.svg",
logoDark: "twitter-dark.svg",
logo: "/twitter.svg",
logoDark: "/twitter-dark.svg",
bg: "#fff",
text: "#1da1f2",
bgDark: "#1da1f2",

View File

@@ -306,8 +306,8 @@ export default function VK<P extends Record<string, any> = VkProfile>(
}
},
style: {
logo: "vk.svg",
logoDark: "vk-dark.svg",
logo: "/vk.svg",
logoDark: "/vk-dark.svg",
bg: "#fff",
text: "#07F",
bgDark: "#07F",

View File

@@ -181,8 +181,8 @@ export default function Wikimedia<P extends WikimediaProfile>(
}
},
style: {
logo: "wikimedia.svg",
logoDark: "wikimedia-dark.svg",
logo: "/wikimedia.svg",
logoDark: "/wikimedia-dark.svg",
bg: "#fff",
text: "#000",
bgDark: "#000",

View File

@@ -45,8 +45,8 @@ export default function WorkOS<P extends WorkOSProfile>(
}
},
style: {
logo: "workos.svg",
logoDark: "workos-dark.svg",
logo: "/workos.svg",
logoDark: "/workos-dark.svg",
bg: "#fff",
text: "#6363f1",
bgDark: "#6363f1",