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 0c6b2a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('organizations API', () => {
userUuid,
roles: ['user_admin']
})

expect(createResponse.statusCode).toBe(200)
const orgId = createResponse.body.data.organization.orgId
// orgId is MUUID scalar type which should always be serialized into the muuid hex string format.
Expand Down
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 0c6b2a1

Please sign in to comment.