mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-26 14:32:04 -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}
|
||||
AND provider = 'mastodon'
|
||||
`);
|
||||
if (existingKeys) {
|
||||
return existingKeys;
|
||||
}
|
||||
// TODO figure out why it doesn't work
|
||||
// if (existingKeys) {
|
||||
// return existingKeys;
|
||||
// }
|
||||
const keys = await fetch(`https://${instance}/api/v1/apps`, {
|
||||
method: 'POST',
|
||||
body: new URLSearchParams({
|
||||
@ -54,10 +55,13 @@ const mastodonGetOAuthKeys = async (db, instance) => {
|
||||
},
|
||||
}).then(res => res.json());
|
||||
assert(keys.client_id && keys.client_secret && !keys.error);
|
||||
db.get(SQL`
|
||||
INSERT INTO oauth_keys (instance, provider, client_id, client_secret)
|
||||
VALUES (${instance}, 'mastodon', ${keys.client_id}, ${keys.client_secret})
|
||||
`);
|
||||
// TODO figure out why it doesn't work
|
||||
if (existingKeys) {
|
||||
db.get(SQL`
|
||||
INSERT INTO oauth_keys (instance, provider, client_id, client_secret)
|
||||
VALUES (${instance}, 'mastodon', ${keys.client_id}, ${keys.client_secret})
|
||||
`);
|
||||
}
|
||||
return keys;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user