Content-Type in token reauests
- Linguagem predominante
- Rust
- Estrelas
- 783
- Forks
- 102
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
# Feature
I've been trying this library out yesterday, but after setting up something simillar to the examples, I started making requests, but evey single one was invalid, because i used `application/json` content type instead of `application/x-www-form-urlencoded` (Reading the source code I noticed it isn't even checked (At least in case of rocket frontend) and is automatically decoded with `serde_urlform`.
Yes, the OAuth2 specification doesn't mention JSON content type in the requests, but it has become common to also allow JSON, (Before reading some parts of the specs, I didn't even know JSON isn't the default for OAuth2.) so I belive it should be supported, or at least an option to use custom Content-Type could be added.
## Alternatives
Because this is an extra feature on top of the OAuth2 spec, I think it would need to be an additional feature.
Alternatively (at least in the case of rocket frontend) the Data inside OAuthRequest could be an enum of different grant types (and their data inside), and an additional method could be added, to let users parse the body on their own.
## Context
https://github.com/HeroicKatora/oxide-auth/blob/master/oxide-auth-rocket/src/lib.rs#L97
## Tracking pull request
- [ ] does not exist
Guia de contribuição
Direção de pesquisa
A issue aponta para oxide-auth-rocket/src/lib.rs linha 97, onde o corpo da requisição é decodificado com serde_urlform. Comece examinando como OAuthRequest lida com a análise de dados no frontend do Rocket. Veja os tipos de grant e observe onde a validação do content-type ocorre. Implemente suporte para application/json adicionando lógica de análise ou tornando o campo de dados um enum. Teste com requisições de token para garantir que ambos os tipos de conteúdo funcionem.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Domínio
- api, backend
- Tipo de issue
- Funcionalidade
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 55/100