mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 20:27:44 +00:00
chore(demo): fix sso (#4934)
This commit is contained in:
@@ -88,7 +88,7 @@ export const auth = betterAuth({
|
||||
},
|
||||
account: {
|
||||
accountLinking: {
|
||||
trustedProviders: ["google", "github", "demo-app"],
|
||||
trustedProviders: ["google", "github", "demo-app", "sso"],
|
||||
},
|
||||
},
|
||||
emailAndPassword: {
|
||||
@@ -244,8 +244,9 @@ export const auth = betterAuth({
|
||||
domain: "http://localhost:3000",
|
||||
providerId: "sso",
|
||||
samlConfig: {
|
||||
issuer: "http://localhost:3001/api/sso/saml2/sp/metadata",
|
||||
entryPoint: "http://localhost:3001/api/sso/saml2/sp/acs",
|
||||
issuer: "http://localhost:3000/api/auth/sso/saml2/sp/metadata",
|
||||
entryPoint:
|
||||
"https://dummyidp.com/apps/app_01k16v4vb5yytywqjjvv2b3435",
|
||||
cert: `-----BEGIN CERTIFICATE-----
|
||||
MIIDBzCCAe+gAwIBAgIUCLBK4f75EXEe4gyroYnVaqLoSp4wDQYJKoZIhvcNAQEL
|
||||
BQAwEzERMA8GA1UEAwwIZHVtbXlpZHAwHhcNMjQwNTEzMjE1NDE2WhcNMzQwNTEx
|
||||
@@ -267,7 +268,7 @@ export const auth = betterAuth({
|
||||
-----END CERTIFICATE-----`,
|
||||
spMetadata: {
|
||||
metadata: `
|
||||
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" entityID="http://localhost:3000/api/sso/saml2/sp/metadata">
|
||||
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" entityID="http://localhost:3000/api/auth/sso/saml2/sp/metadata">
|
||||
<md:SPSSODescriptor AuthnRequestsSigned="false" WantAssertionsSigned="false" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
|
||||
<md:KeyDescriptor use="signing">
|
||||
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
|
||||
@@ -283,10 +284,10 @@ export const auth = betterAuth({
|
||||
</ds:X509Data>
|
||||
</ds:KeyInfo>
|
||||
</md:KeyDescriptor>
|
||||
<md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:3000/api/sso/saml2/sp/sls"/>
|
||||
<md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:3000/api/auth/sso/saml2/sp/sls"/>
|
||||
<md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</md:NameIDFormat>
|
||||
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:3000/api/sso/saml2/sp/acs" index="1"/>
|
||||
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:3000/api/sso/saml2/sp/acs" index="1"/>
|
||||
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:3000/api/auth/sso/saml2/sp/acs/sso" index="1"/>
|
||||
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:3000/api/auth/sso/saml2/sp/acs/sso" index="1"/>
|
||||
</md:SPSSODescriptor>
|
||||
<md:Organization>
|
||||
<md:OrganizationName xml:lang="en-US">Organization Name</md:OrganizationName>
|
||||
@@ -308,7 +309,7 @@ export const auth = betterAuth({
|
||||
entityURL:
|
||||
"https://dummyidp.com/apps/app_01k16v4vb5yytywqjjvv2b3435/metadata",
|
||||
entityID:
|
||||
"https://dummyidp.com/apps/app_01k16v4vb5yytywqjjvv2b3435/metadata",
|
||||
"https://dummyidp.com/apps/app_01k16v4vb5yytywqjjvv2b3435",
|
||||
redirectURL:
|
||||
"https://dummyidp.com/apps/app_01k16v4vb5yytywqjjvv2b3435/sso",
|
||||
singleSignOnService: [
|
||||
|
||||
@@ -37,3 +37,8 @@ See [Demo](https://demo.better-auth.com)
|
||||
pnpm dev
|
||||
```
|
||||
4. Open the browser and navigate to `http://localhost:3000`
|
||||
|
||||
### SSO Login Example
|
||||
|
||||
For this example, we utilize DummyIDP. Initiate the login from the [DummyIDP login](https://dummyidp.com/apps/app_01k16v4vb5yytywqjjvv2b3435/login), click "Proceed", and from here it will direct you to user's dashboard.
|
||||
|
||||
Reference in New Issue
Block a user