diff --git a/src/backends/git-gateway/implementation.js b/src/backends/git-gateway/implementation.js index 45eebc9d..cdc3ebe4 100644 --- a/src/backends/git-gateway/implementation.js +++ b/src/backends/git-gateway/implementation.js @@ -55,9 +55,9 @@ export default class GitGateway extends GitHubBackend { .then((token) => { let validRole = true; if (this.accept_roles && this.accept_roles.length > 0) { + const userRoles = get(jwtDecode(token), 'app_metadata.roles', []); validRole = intersection(userRoles, this.accept_roles).length > 0; } - const userRoles = get(jwtDecode(token), 'app_metadata.roles', []); if (validRole) { const userData = { name: user.user_metadata.name || user.email.split('@').shift(),