revert: deletion of oauth.pug

This commit is contained in:
Mar0xy 2023-11-09 15:06:57 +01:00
parent fdb36f1d96
commit 885800ee5e
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
2 changed files with 20 additions and 0 deletions

View file

@ -78,6 +78,17 @@ export class OAuth2ProviderService {
);
});
fastify.get('/oauth/authorize/', async (request, reply) => {
const query: any = request.query;
let param = "mastodon=true";
if (query.state) param += `&state=${query.state}`;
if (query.redirect_uri) param += `&redirect_uri=${query.redirect_uri}`;
const client = query.client_id ? query.client_id : "";
reply.redirect(
`${Buffer.from(client.toString(), 'base64').toString()}?${param}`,
);
});
fastify.post('/oauth/token', async (request, reply) => {
const body: any = request.body || request.query;
if (body.grant_type === "client_credentials") {