mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 09:57:29 -07:00
[mastodon-client] Correctly implement multiple callback URIs for OAuth, resolves #150
This commit is contained in:
parent
29099e4635
commit
5d1a61cb95
1 changed files with 7 additions and 1 deletions
|
@ -111,7 +111,13 @@ export default defineComponent({
|
||||||
}, {});
|
}, {});
|
||||||
const isMastodon = !!getUrlParams().mastodon;
|
const isMastodon = !!getUrlParams().mastodon;
|
||||||
if (this.session.app.callbackUrl && isMastodon) {
|
if (this.session.app.callbackUrl && isMastodon) {
|
||||||
const callbackUrl = new URL(this.session.app.callbackUrl);
|
const redirectUri = decodeURIComponent(getUrlParams().redirect_uri);
|
||||||
|
if (!this.session.app.callbackUrl.split('\n').some(p => p === redirectUri)){
|
||||||
|
this.state = "fetch-session-error";
|
||||||
|
this.fetching = false;
|
||||||
|
throw new Error("callback uri doesn't match registered app");
|
||||||
|
}
|
||||||
|
const callbackUrl = new URL(redirectUri)
|
||||||
callbackUrl.searchParams.append("code", this.session.token);
|
callbackUrl.searchParams.append("code", this.session.token);
|
||||||
if (!!getUrlParams().state)
|
if (!!getUrlParams().state)
|
||||||
callbackUrl.searchParams.append(
|
callbackUrl.searchParams.append(
|
||||||
|
|
Loading…
Reference in a new issue