Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(oauth): redirect back to popout url if needed #2655

Merged
merged 1 commit into from Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions public/oauth.html
Expand Up @@ -59,11 +59,11 @@
try {
const url = new URL(window.location.href);
const code = url.searchParams.get('code');
const state = window.atob(url.searchParams.get('state'));
const state = JSON.parse(window.atob(url.searchParams.get('state')));

// save token code to localStorage
localStorage.setItem('code', code);
window.location.replace(`${state}`);
window.location.replace(`${state.popoutUrl || state.url}`);
} catch (error) {
console.log({error});
window.location.replace(window.location.origin + '/login');
Expand Down
7 changes: 6 additions & 1 deletion src/login/views/login.vue
Expand Up @@ -37,7 +37,12 @@ export default class Login extends Vue {
}

login() {
window.location.replace('http://oauth.sogebot.xyz/?state=' + encodeURIComponent(window.btoa(this.url)))
window.location.replace('http://oauth.sogebot.xyz/?state=' + encodeURIComponent(window.btoa(
JSON.stringify({
popoutUrl: this.popoutUrl,
url: this.url,
})
)))
}

mounted() {
Expand Down