Fragment
What kind of change does this PR introduce? (check at least one)
- [ ] Bugfix
- [X] Feature
- [ ] Code style update
- [ ] Refactor
- [ ] Other, please describe:
- [X] You consent that the copyright of your pull request source code belongs to Authlib's author.
This allows a parameter in_fragment to be passed into prepare_grant_uri(), when enabled, this will place OAuth parameters into the URL fragment rather than the query string. Further, it modifies add_params_to_uri() so that the original fragment is left unmolested (not made part of the parameters).
This is needed since I am using Vuejs for my frontend, and making API calls to perform OAuth2 authorization. I am using an authorization url such as:
http://localhost:8000/#/authorize
Without the in_fragment param, you would receive the url:
http://localhost:8000/?response_type=...#/authorize
And without preserving the fragment, you would get:
http://localhost:8000/#/authorize?%2Fauthorize&response_type=...
With these changes, the URL is correctly:
http://localhost:8000/#/authorize?response_type=...