Hello, we set up an SSO flow in the Descope consol...
# ask-a-descoper
t
Hello, we set up an SSO flow in the Descope console that links to our Google account. I then used the NextJS SDK to integrate Descope into our web app. After signing in, I am successfully redirected to the Post Authentication Redirect URL in Authentication Methods > SSO settings. However, user data is
undefined
on the server and client side. Did we miss a setting in the console?
c
Hey Tony, most likely the data isn't being mapped in the response. Is this for access to the console being federated through your google accounts, or to a tenant within your Descope project? Set up via OIDC or SAML?
t
@Hugo Villanueva
h
The setup is via SAML, and setting up a tenant within our Descope project
We're testing using a flow that we created using "Start from template" that has SSO, when I run the flow in Descope's UI, I see the data I'm expecting in the "Authentication response" for the
user
key which makes me think we're doing the mapping correctly.
Copy code
{
  "claims": {
    "amr": [
      "fed"
    ],
    "dct": "tenantName"
  },
  "cookieDomain": "",
  "cookieExpiration": 1760626095,
  "cookieMaxAge": 2419199,
  "cookiePath": "/",
  "firstSeen": false,
  "idpResponse": null,
  "refreshJwt": "REDACTED",
  "sessionExpiration": 1758207495,
  "sessionJwt": "REDACTED",
  "user": {
    "OAuth": {},
    "SAML": true,
    "SCIM": false,
    "TOTP": false,
    "createdTime": 1757601389,
    "customAttributes": {},
    "email": "email@grazzy.com",
    "externalIds": [
      "email@grazzy.com-tenantName"
    ],
    "familyName": "lastName",
    "givenName": "firstName",
    "loginIds": [
      "email@grazzy.com-tenantName"
    ],
    "middleName": "",
    "name": "email@grazzy.com",
    "password": false,
    "phone": "",
    "picture": "",
    "push": false,
    "roleNames": [],
    "ssoAppIds": [],
    "status": "enabled",
    "test": false,
    "userId": "someId",
    "userTenants": [
      {
        "roleNames": [],
        "tenantId": "tenantName",
        "tenantName": "Some Tenant"
      }
    ],
    "verifiedEmail": true,
    "verifiedPhone": false,
    "webauthn": false
  }
}
c
@Hugo Villanueva - where is the
undefined
occurring? Within your client, once you've successfully authenticated, are you checking the user details via the
useUser
or
me
endpoints? Or are you looking directly at the user's JWT token?
h
@Chris Carper, it seems like the issue was that we weren't setting the
tenant_id
when calling the SSO flow so I think we figured out this issue, now we're going to test setting the
tenant_id
to match the
email
domain so that we don't have to worry about having to set this on NextJS.
c
Yeah, that makes sense. Are you using the SSO-enabled condition within the flow? That paired with the SSO action, should force the tenant to be selected. https://docs.descope.com/flows/conditions/sso-enforced
h
That article was very helpful, thank you for sharing
c
No problem! Feel free to reach out if anything else pops up.