Conversation
Comment on lines
+236
to
+248
| oauth.post('/client', async (req, res) => { | ||
| if (!req.session.user) { | ||
| res.sendStatus(401); | ||
| return; | ||
| } | ||
| const { name } = req.body; | ||
| if (!name) { | ||
| res.status(400).send('Missing client application name'); | ||
| return; | ||
| } | ||
| const client = await createOAuthClient(name, req.session.user); | ||
| res.status(201).json(client); | ||
| }); |
Floha258
requested changes
Jun 4, 2026
| return; | ||
| } | ||
| if (!client.redirectUris.includes(redirectUri)) { | ||
| res.status(400).send('Invalid redirect uri'); |
Comment on lines
+249
to
+280
| oauth | ||
| .route('/:id') | ||
| .get(async (req, res) => { | ||
| const { id } = req.params; | ||
| const client = await getClient(id); | ||
| if (!client) { | ||
| res.sendStatus(404); | ||
| return; | ||
| } | ||
| res.json(client); | ||
| }) | ||
| .delete(async (req, res) => { | ||
| const { id } = req.params; | ||
| await deleteClient(id); | ||
| res.sendStatus(200); | ||
| }) | ||
| .post(async (req, res) => { | ||
| const { id } = req.params; | ||
| const { name, redirects } = req.body; | ||
| if (!name && !redirects) { | ||
| res.sendStatus(400); | ||
| return; | ||
| } | ||
| const client = await updateClient(id, name, redirects); | ||
| res.status(200).json(client); | ||
| }); | ||
|
|
||
| oauth.post('/:id/resetSecret', async (req, res) => { | ||
| const { id } = req.params; | ||
| const newSecret = await resetClientSecret(id); | ||
| res.status(200).json(newSecret); | ||
| }); |
Collaborator
There was a problem hiding this comment.
Am I missing some form of authorization in here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the OAuth2 spec in the PlayBingo API, allowing third party components to authenticate requests on behalf of users.
This implementation represents multiple features
Security
Whenever the Authorization header is present on a request, the session will be converted to an OAuth session (even if the token is invalid or malformed - this prevents session poisoning/leaking or the ability to maintain access past revocation/expiration). If the token is successfully verified, the user is re-added to the session, otherwise it is cleared. This minimizes the security relevant change footprint of this in terms of existing checks.