Skip to content

Commit b9656c2

Browse files
u0xaa55jmraxa
andauthored
feat(react-oidc): enforce uniqueness of redirect_uri and silent_redirect_uri (#1606) (release)
Co-authored-by: Jean-Marc Rakotoarisoa <jeanmarc.rakotoarisoa@axa.fr>
1 parent 960a694 commit b9656c2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

packages/react-oidc/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ const App = () => (
182182
render(<App />, document.getElementById('root'));
183183
```
184184

185+
> [!WARNING]
186+
> If you have both `redirect_uri` and `silent_redirect_uri` configured, their value must be different.
187+
185188
```javascript
186189
const configuration = {
187190
loadingComponent: ReactComponent, // you can inject your own loading component

packages/react-oidc/src/OidcProvider.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ export const OidcProvider: FC<PropsWithChildren<OidcProviderProps>> = ({
102102
getFetch = null,
103103
location = null,
104104
}) => {
105+
if (configuration && configuration.redirect_uri && configuration.silent_redirect_uri) {
106+
if (configuration.redirect_uri === configuration.silent_redirect_uri) {
107+
throw new Error('redirect_uri and silent_redirect_uri must be different');
108+
}
109+
}
110+
105111
const getOidc = (configurationName = 'default') => {
106112
return OidcClient.getOrCreate(getFetch ?? getFetchDefault, location ?? new OidcLocation())(
107113
configuration,

0 commit comments

Comments
 (0)