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

adjust default fusionauth provider details #10868

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 24 additions & 2 deletions packages/core/src/providers/fusionauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,38 @@
return {
id: "fusionauth",
name: "FusionAuth",
type: "oauth",
type: "oidc",

Check warning on line 108 in packages/core/src/providers/fusionauth.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/fusionauth.ts#L108

Added line #L108 was not covered by tests
wellKnown: options?.tenantId
? `${options.issuer}/.well-known/openid-configuration?tenantId=${options.tenantId}`
: `${options.issuer}/.well-known/openid-configuration`,
authorization: {
params: {
scope: "openid offline_access",
scope: "openid offline_access email profile",

Check warning on line 114 in packages/core/src/providers/fusionauth.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/fusionauth.ts#L114

Added line #L114 was not covered by tests
...(options?.tenantId && { tenantId: options.tenantId }),
},
},
userinfo: `${options.issuer}/oauth2/userinfo`,
// This is due to a known processing issue
// TODO: https://github.com/nextauthjs/next-auth/issues/8745#issuecomment-1907799026
token: {
url: `${options.issuer}/oauth2/token`,
conform: async (response: Response) => {
if (response.status === 401) return response

const newHeaders = Array.from(response.headers.entries())
.filter(([key]) => key.toLowerCase() !== "www-authenticate")
.reduce(
(headers, [key, value]) => (headers.append(key, value), headers),
new Headers()
)

return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
})
},
},

Check warning on line 139 in packages/core/src/providers/fusionauth.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/fusionauth.ts#L118-L139

Added lines #L118 - L139 were not covered by tests
checks: ["pkce", "state"],
profile(profile) {
return {
Expand Down
Loading