find nameId of specific user with a given loginid in org
The query [1] will list all users with samlIds in the org, but how can I craft the query to search for a user with a specific login?
[1]
query Users($org: String!, $first: Int = 100, $after: String) {
organization(login: $org) {
samlIdentityProvider {
externalIdentities(first: $first, after: $after) {
edges {
node {
guid,
samlIdentity {
nameId
}
user {
login
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}
find wordpress nameId of specific user with a given loginid in org
https://github.com/github/platform-samples/issues/414#issue-990346628
@davidkarlsen, just stumbled upon this, hope that after 2+ years the below is still helpful
query user($org: String!, $login: String = null, $after: String = null) {
organization(login: $org) {
samlIdentityProvider {
externalIdentities(login: $login, first: 100, after: $after) {
nodes {
guid
samlIdentity {
nameId
}
user {
login
organizationVerifiedDomainEmails(login: $org)
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}
Similarly, if you want to search by IdP username (for us, this is the user's UPN/AAD username/email) replace login: with userName:. We use enterprise instead of organization (more here: https://stackoverflow.com/a/50614349/361842)
{
enterprise(slug: "my-enterprise-name") {
ownerInfo {
samlIdentityProvider {
externalIdentities(after: null, first: 100, userName: "[email protected]") {
totalCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
user {
login
}
samlIdentity {
nameId
}
}
}
}
}
}
}
}