Add the possibility of having a sequence of strings as scopes#146
Add the possibility of having a sequence of strings as scopes#146naumazeredo wants to merge 1 commit intoramosbugs:mainfrom
Conversation
|
Hey, thanks for the PR! Based on my reading of RFC 6749, this behavior doesn't quite follow the spec, unless there's a newer standard that allows a JSON array of strings instead of a space-delimited list of strings. I would prefer to keep
This is useful feedback, thank you! I've also run into similar debugging pain. The reason this crate uses |
|
See also #52 |
|
Didn't check if Twitch was just breaking the RFC, sorry. Closing. |
|
@naumazeredo did you resolve this issue? I've exhausted all the AI's and they can't seem to resolve this issue. Totally stuck. |
Some OAuth2 APIs have a sequence of strings as scope in the client credentials response (e.g.: Twitch), which is not supported in the current oauth2-rs state.
This PR just adds the deserialization to this case.
The easiest approach was to create an abstraction
enumto encapsulate both options during deserialization (and avoid touching Option parsing and Visitor design altogether). The change only affects the deserialization helper.Not part of the PR:
To be honest, I had a tough time debugging this. Passing a slice, instead of a string, to serde deserialization makes it very annoying to debug since all parsing errors prints the characters as
u8instead of the correct JSON string and makes the debugging way more cumbersome. In case I keep using this crate I'll probably submit some other PRs to both add examples for move parts (had to reverse engineer the client credentials part to both know what to use and where this bug was) and better error messages.Thanks for the work on this crate. Saved me quite some time.