amplify-js: Error in Cognito Federated Login Azure AD with redirectSignIn http://localhost:5173 but not with localhost:5173
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
I have a federated login with Cognito and AZURE AD in **React+VITE**, in AWS within Allowed callback URLs:
I have localhost:5173 and also http://localhost5173.
Describe the bug
I have a federated login with Cognito and AZURE AD in React+VITE, in AWS within Allowed callback URLs: I have localhost:5173 and also http://localhost5173.
In my Amplify configuration inside the front project when on redirectSignIn: I have the following value [‘localhost:5173’], it redirects me to outlook and I can log in successfully
, but if I change the value to ['http://localhost:5173/ '] I get the following error:
403 Forbidden: You don’t have permission to access this resource.
What could be the problem? if both urls are authorized
Expected behavior
I hope that with both urls it works fine and redirects me to outlook, but it only happens with localhost:5173 and not with http://localhost:5173
Reproduction steps
I follow these steps https://docs.amplify.aws/react/build-a-backend/auth/add-social-provider/
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
Amplify.configure({
Auth: {
Cognito: {
userPoolId: 'xxxxxx',
userPoolClientId: 'xxxxxx',
loginWith: {
oauth: {
domain: 'xxx.com',
scopes: ['openid'],
redirectSignIn: ['http://localhost:5173/'],
redirectSignOut: ['localhost:5173'],
responseType: 'code',
},
},
},
},
});
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (6 by maintainers)
Same issue here. It was because we had configured the WAF. Temporarily disabling the WAF and the HTTP:// works !
@nadetastic I am happy to debug and work through this issue. It is a blocker for my team.
Hi @danteyc thank you for opening this issue. What you are experiencing sounds as what is expected by Cognito. As seen in the documentation here, Amazon Cognito requires the allowed call back URLs to have either HTTPS or HTTP for localhost ( but for testing purposes only). Thus any calllback (or signout url) that is not prepended with HTTP/HTTPS will fail.