mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-28 23:42:58 -04:00
[user] mastodon login - don't reuse keys, looks like it's not working
This commit is contained in:
parent
d9870c12c1
commit
38026537e7
@ -37,9 +37,10 @@ const mastodonGetOAuthKeys = async (db, instance) => {
|
|||||||
WHERE instance = ${instance}
|
WHERE instance = ${instance}
|
||||||
AND provider = 'mastodon'
|
AND provider = 'mastodon'
|
||||||
`);
|
`);
|
||||||
if (existingKeys) {
|
// TODO figure out why it doesn't work
|
||||||
return existingKeys;
|
// if (existingKeys) {
|
||||||
}
|
// return existingKeys;
|
||||||
|
// }
|
||||||
const keys = await fetch(`https://${instance}/api/v1/apps`, {
|
const keys = await fetch(`https://${instance}/api/v1/apps`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
@ -54,10 +55,13 @@ const mastodonGetOAuthKeys = async (db, instance) => {
|
|||||||
},
|
},
|
||||||
}).then(res => res.json());
|
}).then(res => res.json());
|
||||||
assert(keys.client_id && keys.client_secret && !keys.error);
|
assert(keys.client_id && keys.client_secret && !keys.error);
|
||||||
|
// TODO figure out why it doesn't work
|
||||||
|
if (existingKeys) {
|
||||||
db.get(SQL`
|
db.get(SQL`
|
||||||
INSERT INTO oauth_keys (instance, provider, client_id, client_secret)
|
INSERT INTO oauth_keys (instance, provider, client_id, client_secret)
|
||||||
VALUES (${instance}, 'mastodon', ${keys.client_id}, ${keys.client_secret})
|
VALUES (${instance}, 'mastodon', ${keys.client_id}, ${keys.client_secret})
|
||||||
`);
|
`);
|
||||||
|
}
|
||||||
return keys;
|
return keys;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user