{"action":"created","comment":{"url":"https://api.github.com/repos/ProjectResound/store-upload/pulls/comments/226640570","pull_request_review_id":166514728,"id":226640570,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjY0MDU3MA==","diff_hunk":"@@ -55,8 +65,9 @@ export default class Auth {\n       localStorage.removeItem(\"access_token\");\n       localStorage.removeItem(\"id_token\");\n       localStorage.removeItem(\"expires_at\");\n+      localStorage.removeItem(\"tenant\");\n     }\n-    UserActions.loggedOut();\n+    this.auth0.logout({ returnTo: returnTo });","path":"src/scripts/services/auth.js","position":59,"original_position":59,"commit_id":"c832ff24ab9eba82ce9086756c780f676e49a96f","original_commit_id":"c832ff24ab9eba82ce9086756c780f676e49a96f","user":{"login":"jonatasrancan","id":651096,"node_id":"MDQ6VXNlcjY1MTA5Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/651096?v=4","gravatar_id":"","url":"https://api.github.com/users/jonatasrancan","html_url":"https://github.com/jonatasrancan","followers_url":"https://api.github.com/users/jonatasrancan/followers","following_url":"https://api.github.com/users/jonatasrancan/following{/other_user}","gists_url":"https://api.github.com/users/jonatasrancan/gists{/gist_id}","starred_url":"https://api.github.com/users/jonatasrancan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonatasrancan/subscriptions","organizations_url":"https://api.github.com/users/jonatasrancan/orgs","repos_url":"https://api.github.com/users/jonatasrancan/repos","events_url":"https://api.github.com/users/jonatasrancan/events{/privacy}","received_events_url":"https://api.github.com/users/jonatasrancan/received_events","type":"User","site_admin":false},"body":"@nakedsushi I solved my problem with the logout, doing this.","created_at":"2018-10-19T13:09:36Z","updated_at":"2018-10-19T13:09:37Z","html_url":"https://github.com/ProjectResound/store-upload/pull/26#discussion_r226640570","pull_request_url":"https://api.github.com/repos/ProjectResound/store-upload/pulls/26","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ProjectResound/store-upload/pulls/comments/226640570"},"html":{"href":"https://github.com/ProjectResound/store-upload/pull/26#discussion_r226640570"},"pull_request":{"href":"https://api.github.com/repos/ProjectResound/store-upload/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/ProjectResound/store-upload/pulls/26","id":220458609,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwNDU4NjA5","html_url":"https://github.com/ProjectResound/store-upload/pull/26","diff_url":"https://github.com/ProjectResound/store-upload/pull/26.diff","patch_url":"https://github.com/ProjectResound/store-upload/pull/26.patch","issue_url":"https://api.github.com/repos/ProjectResound/store-upload/issues/26","number":26,"state":"open","locked":false,"title":"WIP: Multi Tenancy","user":{"login":"jonatasrancan","id":651096,"node_id":"MDQ6VXNlcjY1MTA5Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/651096?v=4","gravatar_id":"","url":"https://api.github.com/users/jonatasrancan","html_url":"https://github.com/jonatasrancan","followers_url":"https://api.github.com/users/jonatasrancan/followers","following_url":"https://api.github.com/users/jonatasrancan/following{/other_user}","gists_url":"https://api.github.com/users/jonatasrancan/gists{/gist_id}","starred_url":"https://api.github.com/users/jonatasrancan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonatasrancan/subscriptions","organizations_url":"https://api.github.com/users/jonatasrancan/orgs","repos_url":"https://api.github.com/users/jonatasrancan/repos","events_url":"https://api.github.com/users/jonatasrancan/events{/privacy}","received_events_url":"https://api.github.com/users/jonatasrancan/received_events","type":"User","site_admin":false},"body":"@nakedsushi\r\nTo fully test this, you will need to add to your auth0 account the following rule, to save the tenant information on user profile on auth0 side.\r\n\r\n```js\r\nfunction (user, context, callback) {\r\n  var namespace = 'https://myauth0.com/';\r\n  var url = require('url');\r\n  user.app_metadata = user.app_metadata || {};\r\n  let tenant = url.parse(\r\n    context.request.query.redirect_uri\r\n   ).hostname.split('.')[0];\r\n  let userTenant = user.app_metadata.tenant;\r\n  \r\n  if(userTenant === undefined) {\r\n    user.app_metadata.tenant = tenant;\r\n    var appMetadataPromise  = auth0.users.updateAppMetadata(user.user_id, user.app_metadata);\r\n      \r\n    q.all([appMetadataPromise])\r\n      .then(function(){\r\n        if (context.idToken && user.app_metadata) {\r\n          context.idToken[namespace + 'tenant'] = user.app_metadata.tenant;\r\n        }\r\n        return callback(null, user, context);\r\n      })\r\n      .catch(function(err){\r\n        return callback(err);\r\n      });\r\n  } else {\r\n    if(userTenant === tenant) {\r\n      if (context.idToken && user.app_metadata) {\r\n        context.idToken[namespace + 'tenant'] = user.app_metadata.tenant;\r\n      }\r\n      return callback(null, user, context);    \r\n    } else {\r\n      return callback(new UnauthorizedError('Your account does not belongs to this domain.'));\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nAlso on the app setup, you need to white list the permitted urls for the logout redirect\r\n![logout-urls](https://user-images.githubusercontent.com/651096/47218954-cc814300-d383-11e8-8a89-0da9a7ce6030.png)\r\n\r\n\r\nAnother detail, I don't know if you have access to your auth0 account, but our is running Node 8, I think your is running on Node 4. So if you got some strange behavior, keep thins in mind.\r\nMore info here: https://auth0.com/docs/migrations/guides/extensibility-node8\r\n","created_at":"2018-10-04T17:32:39Z","updated_at":"2018-10-19T13:09:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29a5ba0890233dcbe7c706d65a86ceb838035784","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ProjectResound/store-upload/pulls/26/commits","review_comments_url":"https://api.github.com/repos/ProjectResound/store-upload/pulls/26/comments","review_comment_url":"https://api.github.com/repos/ProjectResound/store-upload/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ProjectResound/store-upload/issues/26/comments","statuses_url":"https://api.github.com/repos/ProjectResound/store-upload/statuses/c832ff24ab9eba82ce9086756c780f676e49a96f","head":{"label":"jonatasrancan:multi-tenancy","ref":"multi-tenancy","sha":"c832ff24ab9eba82ce9086756c780f676e49a96f","user":{"login":"jonatasrancan","id":651096,"node_id":"MDQ6VXNlcjY1MTA5Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/651096?v=4","gravatar_id":"","url":"https://api.github.com/users/jonatasrancan","html_url":"https://github.com/jonatasrancan","followers_url":"https://api.github.com/users/jonatasrancan/followers","following_url":"https://api.github.com/users/jonatasrancan/following{/other_user}","gists_url":"https://api.github.com/users/jonatasrancan/gists{/gist_id}","starred_url":"https://api.github.com/users/jonatasrancan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonatasrancan/subscriptions","organizations_url":"https://api.github.com/users/jonatasrancan/orgs","repos_url":"https://api.github.com/users/jonatasrancan/repos","events_url":"https://api.github.com/users/jonatasrancan/events{/privacy}","received_events_url":"https://api.github.com/users/jonatasrancan/received_events","type":"User","site_admin":false},"repo":{"id":149658069,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk2NTgwNjk=","name":"store-upload","full_name":"jonatasrancan/store-upload","private":false,"owner":{"login":"jonatasrancan","id":651096,"node_id":"MDQ6VXNlcjY1MTA5Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/651096?v=4","gravatar_id":"","url":"https://api.github.com/users/jonatasrancan","html_url":"https://github.com/jonatasrancan","followers_url":"https://api.github.com/users/jonatasrancan/followers","following_url":"https://api.github.com/users/jonatasrancan/following{/other_user}","gists_url":"https://api.github.com/users/jonatasrancan/gists{/gist_id}","starred_url":"https://api.github.com/users/jonatasrancan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonatasrancan/subscriptions","organizations_url":"https://api.github.com/users/jonatasrancan/orgs","repos_url":"https://api.github.com/users/jonatasrancan/repos","events_url":"https://api.github.com/users/jonatasrancan/events{/privacy}","received_events_url":"https://api.github.com/users/jonatasrancan/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jonatasrancan/store-upload","description":"Client that lets users upload WAVs to the resound-api","fork":true,"url":"https://api.github.com/repos/jonatasrancan/store-upload","forks_url":"https://api.github.com/repos/jonatasrancan/store-upload/forks","keys_url":"https://api.github.com/repos/jonatasrancan/store-upload/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jonatasrancan/store-upload/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jonatasrancan/store-upload/teams","hooks_url":"https://api.github.com/repos/jonatasrancan/store-upload/hooks","issue_events_url":"https://api.github.com/repos/jonatasrancan/store-upload/issues/events{/number}","events_url":"https://api.github.com/repos/jonatasrancan/store-upload/events","assignees_url":"https://api.github.com/repos/jonatasrancan/store-upload/assignees{/user}","branches_url":"https://api.github.com/repos/jonatasrancan/store-upload/branches{/branch}","tags_url":"https://api.github.com/repos/jonatasrancan/store-upload/tags","blobs_url":"https://api.github.com/repos/jonatasrancan/store-upload/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jonatasrancan/store-upload/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jonatasrancan/store-upload/git/refs{/sha}","trees_url":"https://api.github.com/repos/jonatasrancan/store-upload/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jonatasrancan/store-upload/statuses/{sha}","languages_url":"https://api.github.com/repos/jonatasrancan/store-upload/languages","stargazers_url":"https://api.github.com/repos/jonatasrancan/store-upload/stargazers","contributors_url":"https://api.github.com/repos/jonatasrancan/store-upload/contributors","subscribers_url":"https://api.github.com/repos/jonatasrancan/store-upload/subscribers","subscription_url":"https://api.github.com/repos/jonatasrancan/store-upload/subscription","commits_url":"https://api.github.com/repos/jonatasrancan/store-upload/commits{/sha}","git_commits_url":"https://api.github.com/repos/jonatasrancan/store-upload/git/commits{/sha}","comments_url":"https://api.github.com/repos/jonatasrancan/store-upload/comments{/number}","issue_comment_url":"https://api.github.com/repos/jonatasrancan/store-upload/issues/comments{/number}","contents_url":"https://api.github.com/repos/jonatasrancan/store-upload/contents/{+path}","compare_url":"https://api.github.com/repos/jonatasrancan/store-upload/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jonatasrancan/store-upload/merges","archive_url":"https://api.github.com/repos/jonatasrancan/store-upload/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jonatasrancan/store-upload/downloads","issues_url":"https://api.github.com/repos/jonatasrancan/store-upload/issues{/number}","pulls_url":"https://api.github.com/repos/jonatasrancan/store-upload/pulls{/number}","milestones_url":"https://api.github.com/repos/jonatasrancan/store-upload/milestones{/number}","notifications_url":"https://api.github.com/repos/jonatasrancan/store-upload/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jonatasrancan/store-upload/labels{/name}","releases_url":"https://api.github.com/repos/jonatasrancan/store-upload/releases{/id}","deployments_url":"https://api.github.com/repos/jonatasrancan/store-upload/deployments","created_at":"2018-09-20T19:13:00Z","updated_at":"2018-10-11T19:18:19Z","pushed_at":"2018-10-19T12:44:27Z","git_url":"git://github.com/jonatasrancan/store-upload.git","ssh_url":"git@github.com:jonatasrancan/store-upload.git","clone_url":"https://github.com/jonatasrancan/store-upload.git","svn_url":"https://github.com/jonatasrancan/store-upload","homepage":"","size":746,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ProjectResound:master","ref":"master","sha":"4e246876734d1a1787ba07699e800695ad79f0c7","user":{"login":"ProjectResound","id":22082123,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMDgyMTIz","avatar_url":"https://avatars0.githubusercontent.com/u/22082123?v=4","gravatar_id":"","url":"https://api.github.com/users/ProjectResound","html_url":"https://github.com/ProjectResound","followers_url":"https://api.github.com/users/ProjectResound/followers","following_url":"https://api.github.com/users/ProjectResound/following{/other_user}","gists_url":"https://api.github.com/users/ProjectResound/gists{/gist_id}","starred_url":"https://api.github.com/users/ProjectResound/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProjectResound/subscriptions","organizations_url":"https://api.github.com/users/ProjectResound/orgs","repos_url":"https://api.github.com/users/ProjectResound/repos","events_url":"https://api.github.com/users/ProjectResound/events{/privacy}","received_events_url":"https://api.github.com/users/ProjectResound/received_events","type":"Organization","site_admin":false},"repo":{"id":88551309,"node_id":"MDEwOlJlcG9zaXRvcnk4ODU1MTMwOQ==","name":"store-upload","full_name":"ProjectResound/store-upload","private":false,"owner":{"login":"ProjectResound","id":22082123,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMDgyMTIz","avatar_url":"https://avatars0.githubusercontent.com/u/22082123?v=4","gravatar_id":"","url":"https://api.github.com/users/ProjectResound","html_url":"https://github.com/ProjectResound","followers_url":"https://api.github.com/users/ProjectResound/followers","following_url":"https://api.github.com/users/ProjectResound/following{/other_user}","gists_url":"https://api.github.com/users/ProjectResound/gists{/gist_id}","starred_url":"https://api.github.com/users/ProjectResound/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProjectResound/subscriptions","organizations_url":"https://api.github.com/users/ProjectResound/orgs","repos_url":"https://api.github.com/users/ProjectResound/repos","events_url":"https://api.github.com/users/ProjectResound/events{/privacy}","received_events_url":"https://api.github.com/users/ProjectResound/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ProjectResound/store-upload","description":"Client that lets users upload WAVs to the resound-api","fork":false,"url":"https://api.github.com/repos/ProjectResound/store-upload","forks_url":"https://api.github.com/repos/ProjectResound/store-upload/forks","keys_url":"https://api.github.com/repos/ProjectResound/store-upload/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ProjectResound/store-upload/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ProjectResound/store-upload/teams","hooks_url":"https://api.github.com/repos/ProjectResound/store-upload/hooks","issue_events_url":"https://api.github.com/repos/ProjectResound/store-upload/issues/events{/number}","events_url":"https://api.github.com/repos/ProjectResound/store-upload/events","assignees_url":"https://api.github.com/repos/ProjectResound/store-upload/assignees{/user}","branches_url":"https://api.github.com/repos/ProjectResound/store-upload/branches{/branch}","tags_url":"https://api.github.com/repos/ProjectResound/store-upload/tags","blobs_url":"https://api.github.com/repos/ProjectResound/store-upload/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ProjectResound/store-upload/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ProjectResound/store-upload/git/refs{/sha}","trees_url":"https://api.github.com/repos/ProjectResound/store-upload/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ProjectResound/store-upload/statuses/{sha}","languages_url":"https://api.github.com/repos/ProjectResound/store-upload/languages","stargazers_url":"https://api.github.com/repos/ProjectResound/store-upload/stargazers","contributors_url":"https://api.github.com/repos/ProjectResound/store-upload/contributors","subscribers_url":"https://api.github.com/repos/ProjectResound/store-upload/subscribers","subscription_url":"https://api.github.com/repos/ProjectResound/store-upload/subscription","commits_url":"https://api.github.com/repos/ProjectResound/store-upload/commits{/sha}","git_commits_url":"https://api.github.com/repos/ProjectResound/store-upload/git/commits{/sha}","comments_url":"https://api.github.com/repos/ProjectResound/store-upload/comments{/number}","issue_comment_url":"https://api.github.com/repos/ProjectResound/store-upload/issues/comments{/number}","contents_url":"https://api.github.com/repos/ProjectResound/store-upload/contents/{+path}","compare_url":"https://api.github.com/repos/ProjectResound/store-upload/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ProjectResound/store-upload/merges","archive_url":"https://api.github.com/repos/ProjectResound/store-upload/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ProjectResound/store-upload/downloads","issues_url":"https://api.github.com/repos/ProjectResound/store-upload/issues{/number}","pulls_url":"https://api.github.com/repos/ProjectResound/store-upload/pulls{/number}","milestones_url":"https://api.github.com/repos/ProjectResound/store-upload/milestones{/number}","notifications_url":"https://api.github.com/repos/ProjectResound/store-upload/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ProjectResound/store-upload/labels{/name}","releases_url":"https://api.github.com/repos/ProjectResound/store-upload/releases{/id}","deployments_url":"https://api.github.com/repos/ProjectResound/store-upload/deployments","created_at":"2017-04-17T21:14:29Z","updated_at":"2018-10-17T18:35:28Z","pushed_at":"2018-10-19T12:44:29Z","git_url":"git://github.com/ProjectResound/store-upload.git","ssh_url":"git@github.com:ProjectResound/store-upload.git","clone_url":"https://github.com/ProjectResound/store-upload.git","svn_url":"https://github.com/ProjectResound/store-upload","homepage":"","size":800,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":6,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ProjectResound/store-upload/pulls/26"},"html":{"href":"https://github.com/ProjectResound/store-upload/pull/26"},"issue":{"href":"https://api.github.com/repos/ProjectResound/store-upload/issues/26"},"comments":{"href":"https://api.github.com/repos/ProjectResound/store-upload/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/ProjectResound/store-upload/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/ProjectResound/store-upload/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ProjectResound/store-upload/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/ProjectResound/store-upload/statuses/c832ff24ab9eba82ce9086756c780f676e49a96f"}},"author_association":"NONE"}}
{"actor":{"display_login":"jonatasrancan"}}