B2B Saas Authentication

/

API reference

/

Connected Apps

/

Methods

/

Get UserInfo

Get UserInfo

GET
https://test.stytch.com/v1/public/${projectId}/oauth2/userinfo

Get claims about the authenticated end-user, using an Access Token. Claims that do not exist will be omitted.

The contents of the response depend on the scopes granted to the client:

  • All responses will always contain the sub claim.
  • If the profile scope is granted, the name, given_name, family_name, profile_picture, and locale claims will be returned.
  • If the email scope is granted, the email and email_verified claims will be returned.
  • If the phone scope is granted, the phone_number and phone_number_verified claims will be returned.

You can call this endpoint via both GET and POST.

Important: Unlike other Stytch API endpoints, this endpoint is not authenticated with a project_id and project_secret pair. Instead, it is authenticated via the access_token of an active Connected App Client within the current project. You will need to pass the access token as a header with the "bearer" prefix.

This endpoint implements the OpenID Connect Core 1.0 UserInfo Endpoint.


Path parameters


project_id*string

Response fields


substring

phone_numberstring

phone_number_verifiedboolean

emailstring

email_verifiedboolean

namestring

given_namestring

middle_namestring

family_namestring

picturestring

localestring

status_codeint

request_idstring
curl --request GET \
	--url https://test.stytch.com/v1/public/PROJECT_ID/oauth2/userinfo \
	-H 'Authorization: bearer PvC5UudZ7TPZbELt95yXAQ-8MeEUCRob8bUQ-g52fIJs'
RESPONSE
{
	"email": "sandbox@stytch.com",
	"email_verified": true,
    "name" : "Jane Doe",
    "given_name" : "Jane",
    "family_name" : "Doe",
    "middle_name" : "",
	"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
	"status_code": 200,
	"sub": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f"
}