Where is spMetadata supposed to come from?
Hey we are trying to setup SSO with Entra ID and SAML 2.0 right now. The docs are somewhat unclear on how this should be done exactly. One particularly confusing part is the spMetadata. Where is this supposed to come from, do we have to come up with one ourselves? Shouldn't better-auth provide this automatically?
12 Replies
I have same doubt. Can anyone help?
Single Sign-On (SSO) | Better Auth
Integrate Single Sign-On (SSO) with your application.
Does that answer your question?
That has to happen AFTER registering the SAML Provider
but spMetadata is required field here, when we register a provider. What should we pass there?
https://www.better-auth.com/docs/plugins/sso#register-a-saml-provider
Single Sign-On (SSO) | Better Auth
Integrate Single Sign-On (SSO) with your application.
Yeah right, also 
auth.api.spMetadata just returns the config provided during registration. So to be more clear, how do we get the spMetadata in the first place? Do we have to come up with it ourselves? That doesn't seem quite right @The UntraceableYou need to generate your own service provider metadata, using an XML file. When registering you enter data such as:
You need to set this all up
Hey @The Untraceable , after implementing the SSO for one of our customers I'm quite sure the spMetadata is not something we should need to set ourselves but rather should be generated by better-auth automatically. Are you maintaining the SSO plugin or is there someone else I can reach out to to discuss this?
I'm not a maintainer, make a GH issue
@Gigadroid do you have a working SAML implementation with SSO and entra?
I’ve been banging my head for months to get something implemented but keep running into road blocks
@Shifty yeah got it working for entra
And it’s working after update? Every time I try to sign in with SSO I get [object Object] is not JSON
also what kind of database adapter are you using?
GitHub
feat(sso): provide default service provider metadata by dvanmali ·...
Provides default sp metadata for the /sso/saml2/sp/metadata endpoint. Additional improvements with type specifying SAMLConfig type when needed.
Fixes: #4833
Summary by cubic
Adds default Service ...