Skip to main content

User Profile

These functions read and update user profile data from the OIDC userinfo endpoint and the SCIM2 /Me endpoint.

getUserInfo(config)

Fetch user claims from the OIDC userinfo endpoint. Requires a valid access token attached to the request.

import { getUserInfo } from '@thunderid/javascript'

const user = await getUserInfo({
url: 'https://localhost:8090/oauth2/userinfo',
headers: {
Authorization: `Bearer ${accessToken}`,
},
})

console.log(user.email, user.displayName)

Parameters

ParameterTypeRequiredDescription
config.urlstringFull userinfo endpoint URL
config.headersRecord<string, string>Request headers. Include Authorization: Bearer <token>

Response: User

PropertyTypeDescription
substringSubject identifier (unique user ID)
displayNamestringUser's display name
usernamestringUsername
emailstringEmail address
given_namestringFirst name
family_namestringLast name
picturestringProfile picture URL

Additional claims returned by the server are accessible as user[claimUri].


getScim2Me(config)

Fetch the authenticated user's full profile from the SCIM2 /Me endpoint. Returns more attributes than getUserInfo() (custom claims, enterprise attributes, etc.).

import { getScim2Me } from '@thunderid/javascript'

const user = await getScim2Me({
baseUrl: 'https://localhost:8090',
headers: {
Authorization: `Bearer ${accessToken}`,
},
})

Parameters

ParameterTypeRequiredDescription
config.urlstringFull SCIM2 /Me endpoint URL. Mutually exclusive with baseUrl
config.baseUrlstringThunderID base URL. SDK appends /scim2/Me
config.fetcherfunctionCustom fetch function override
config.headersRecord<string, string>Additional request headers

Response: User

Returns the same User type as getUserInfo(), but may include additional SCIM2 attributes.


updateMeProfile(config)

Update the authenticated user's profile via the SCIM2 /Me PATCH endpoint.

import { updateMeProfile } from '@thunderid/javascript'

const updated = await updateMeProfile({
baseUrl: 'https://localhost:8090',
payload: {
Operations: [
{
op: 'replace',
value: {
name: {
givenName: 'Updated',
familyName: 'Name',
},
},
},
],
schemas: ['urn:ietf:params:scim:api:messages:2.0:PatchOp'],
},
headers: {
Authorization: `Bearer ${accessToken}`,
},
})

Parameters

ParameterTypeRequiredDescription
config.urlstringFull SCIM2 /Me endpoint URL. Mutually exclusive with baseUrl
config.baseUrlstringThunderID base URL
config.payloadobjectSCIM2 PatchOp request body
config.payload.Operationsobject[]Array of PATCH operations (op, value, path)
config.payload.schemasstring[]Must include 'urn:ietf:params:scim:api:messages:2.0:PatchOp'
config.fetcherfunctionCustom fetch function override

Response: User

The updated user profile.

ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© WSO2 LLC. All rights reserved.Privacy PolicyCookie Policy