(oAuthSession: OAuthSession, requiredScopes: string)
| 133 | * @param requiredScopes - The required scope you are checking if you can use |
| 134 | */ |
| 135 | export async function throwOnMissingOAuthScope(oAuthSession: OAuthSession, requiredScopes: string) { |
| 136 | const tokenInfo = await oAuthSession.getTokenInfo() |
| 137 | if (!tokenInfo.scope.includes(requiredScopes)) { |
| 138 | throw createError({ |
| 139 | status: 403, |
| 140 | message: ERROR_NEED_REAUTH, |
| 141 | }) |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | export function eventHandlerWithOAuthSession<T extends EventHandlerRequest, D>( |
| 146 | handler: EventHandlerWithOAuthSession<T, D>, |
no outgoing calls
no test coverage detected