Client - add PKCE support when authorizing an app

This commit is contained in:
Sam 2022-08-03 16:34:36 +02:00
parent 922ff63d99
commit b96a682eb8
3 changed files with 18 additions and 2 deletions

View File

@ -73,7 +73,15 @@
redirect_uri: `${route.query.redirect_uri}`, redirect_uri: `${route.query.redirect_uri}`,
response_type: `${route.query.response_type}`, response_type: `${route.query.response_type}`,
scope: `${route.query.scope}`, scope: `${route.query.scope}`,
state: `${route.query.state}`, state: `${route.query.state ? route.query.state : ''}`,
code_challenge: `${
route.query.code_challenge ? route.query.code_challenge : ''
}`,
code_challenge_method: `${
route.query.code_challenge_method
? route.query.code_challenge_method
: ''
}`,
}) })
} }
</script> </script>

View File

@ -43,6 +43,12 @@ export const actions: ActionTree<IOAuth2State, IRootState> & IOAuth2Actions = {
if (payload.state) { if (payload.state) {
form.set('state', payload.state) form.set('state', payload.state)
} }
if (payload.code_challenge) {
form.set('code_challenge', payload.code_challenge)
}
if (payload.code_challenge_method) {
form.set('code_challenge_method', payload.code_challenge_method)
}
authApi authApi
.post('oauth/authorize', form, { .post('oauth/authorize', form, {

View File

@ -27,5 +27,7 @@ export interface IOAuth2ClientAuthorizePayload {
redirect_uri: string redirect_uri: string
response_type: string response_type: string
scope: string scope: string
state?: string state: string
code_challenge: string
code_challenge_method: string
} }