quaint-animal-23223
07/17/2024, 11:37 AM{
"birthdate": "string",
"email": "string",
"email_verified": true,
"family_name": "string",
"gender": "string",
"given_name": "string",
"locale": "string",
"middle_name": "string",
"name": "string",
"nickname": "string",
"phone_number": "string",
"phone_number_verified": true,
"picture": "string",
"preferred_username": "string",
"profile": "string",
"sub": "string",
"updated_at": 0,
"website": "string",
"zoneinfo": "string"
}chilly-king-10285
07/17/2024, 11:37 AMchilly-king-10285
07/17/2024, 11:37 AMjavascript import { Configuration, OidcApi } from "@ory/client" const ory = new OidcApi( new Configuration({ basePath: `https://${process.env.ORY_PROJECT_SLUG}.<http://projects.oryapis.com|projects.oryapis.com>`, accessToken: process.env.ORY_API_KEY, }), ) export async function getUserInfo(accessToken: string) { const { data } = await ory.getOidcUserInfo({ headers: { Authorization: "Bearer " + accessToken }, }) console.log(data.email) } In this example, we create a new instance of the Ory SDK with the basePath set to the URL of your Ory Network project. We then define an async function that calls the userinfo function with the accessToken passed as a parameter. The data contains the user attributes returned by the userinfo endpoint. For more details, you can refer to the [Ory documentation](https://www.ory.sh/docs/oauth2-oidc/userinfo-oidc).quaint-animal-23223
07/17/2024, 11:38 AMchilly-king-10285
07/17/2024, 11:38 AMchilly-king-10285
07/17/2024, 11:38 AMchilly-king-10285
07/17/2024, 11:39 AMchilly-king-10285
07/17/2024, 11:40 AMemail scope. For the user's profile information, you would include the profile scope. Here's an example of how to call the userinfo endpoint using the Ory SDK in JavaScript: javascript import { Configuration, OidcApi } from "@ory/client" const ory = new OidcApi( new Configuration({ basePath: `https://${process.env.ORY_PROJECT_SLUG}.<http://projects.oryapis.com|projects.oryapis.com>`, accessToken: process.env.ORY_API_KEY, }), ) export async function getUserInfo(accessToken: string) { const { data } = await ory.getOidcUserInfo({ headers: { Authorization: "Bearer " + accessToken }, }) console.log(data) } In this example, we create a new instance of the Ory SDK with the basePath set to the URL of your Ory Network project. We then define an async function that calls the userinfo function with the accessToken passed as a parameter. The data contains the user attributes returned by the userinfo endpoint. Remember, the specific data returned will depend on the scopes included in the access token used to call the userinfo endpoint. For more details, you can refer to the [Ory documentation](https://www.ory.sh/docs/oauth2-oidc/userinfo-oidc).