Skip to content

Commit

Permalink
encode uri
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesDoberer committed Mar 30, 2020
1 parent 45c6f7d commit cd05b2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugins/auth/public/auth-oauth2/callback.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
var decodedState = atob(
decodeURIComponent(hashParams['state'])
).split('_luigiNonce=');
var appState = decodedState[0] || '';
var appState = decodeURI(decodedState[0]) || '';
var nonce = decodedState[1];

if (nonce !== sessionStorage.getItem('luigi.nonceValue')) {
Expand Down
6 changes: 2 additions & 4 deletions plugins/auth/src/auth-oauth2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@ export default class oAuth2ImplicitGrant {
settings.oAuthData.redirect_uri = `${Helpers.prependOrigin(
settings.oAuthData.redirect_uri
)}?storageType=${Luigi.auth().store.getStorageType()}`;
const nonceSegment = '_luigiNonce=' + generatedNonce;
const encodedNonceUrl = encodeURIComponent(
window.location.href + nonceSegment
settings.oAuthData.state = btoa(
encodeURI(window.location.href) + '_luigiNonce=' + generatedNonce
);
settings.oAuthData.state = btoa(decodeURIComponent(encodedNonceUrl));

for (const name in settings.oAuthData) {
const node = createInputElement(name, settings.oAuthData[name]);
Expand Down

0 comments on commit cd05b2e

Please sign in to comment.