quiet-shoe-2375
08/23/2023, 3:38 PMmagnificent-energy-493
magnificent-energy-493
import { Configuration, OAuth2Api } from "@ory/client"
const ory = new OAuth2Api(
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 revokeConsent() {
const { data } = await ory.revokeOAuth2ConsentSessions({
subject: "some-user-id",
all: true,
})
}
In this code, subject
is the user-id for which you want to revoke the consent. The all
parameter is set to true
to revoke consent for all OAuth2 clients.
Please note that if you are using access and refresh tokens as user sessions instead of browser cookies, you should revise your approach and usage of OAuth2.quiet-shoe-2375
08/23/2023, 9:12 PM