Skip to content

Commit

Permalink
Handle when there is no scope
Browse files Browse the repository at this point in the history
  • Loading branch information
zichongkao committed May 19, 2023
1 parent e5da2b0 commit c07b001
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/auth/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const createContext = async ({ req }): Promise<any> => {
const token = authHeader.substring(7, authHeader.length).trim()
const z = await verifyJWT(token)

user.isBuilder = z?.scope.includes('builder:default')
user.isBuilder = z?.scope?.includes('builder:default')
user.roles = z?.['https://tacos.openbeta.io/roles'] ?? []
const uidStr: string | undefined = z?.['https://tacos.openbeta.io/uuid']
user.uuid = uidStr != null ? muid.from(uidStr) : undefined
Expand Down

0 comments on commit c07b001

Please sign in to comment.