switchAccounts
Overview
This mutation switches to another account (whose account ID you input) owned by the person logged in during the current login session.
Special Considerations
- Must input a valid AccountId of an account owned by the current logged in person.
Inputs
SwitchAccountsArgs
Required Data
accountId: string
Returns
Promise<AuthPayload>
A promise containing the following object / data:
user: {
account: switchedAccount (PrivateAccount),
person: PrivatePerson,
loginId: ID,
}
Example
Running this mutation:
mutation {
switchAccounts(accountId: "ckbb5u1tf00640729cvtp0awh") {
user {
account {
id
name
}
person {
id
firstName
email
}
loginId
}
}
}
Gives us:
{
"data": {
"switchAccounts": {
"user": {
"account": {
"id": "ckbb5u1tf00640729cvtp0awh",
"name": null
},
"person": {
"id": "ckbayt7re001g072936avt48y",
"firstName": null,
"email": "lydia.g.you@gmail.com"
},
"loginId": "5ee2544bee2be40013fdada8"
}
}
}
}
Common Errors
When running this mutation some of the common errors encountered include:
- You do not own this account. (I-4410)
- An account was found but you do not have access to that account.