'bring cookies from the same domain from React?
try this
https://example.com(auth server) -redirect(cookie[token: "abcdef")-> https://dev.example.com(my react admin)
When redirect it to dev.example.com, I put the cookie in, and I want to get the cookie CheckAuth in AuthProvider.
I'd like to get a request from the browser from CheckAuth and get the cookies in it.
const authProvider: AuthProvider = {
login: ({ username }) => {
localStorage.setItem('username', username);
// accept all username/password combinations
return Promise.resolve();
},
logout: () => {
localStorage.removeItem('username');
return Promise.resolve();
},
checkError: () => Promise.resolve(),
checkAuth: (req) => {
const cookies = new Cookies(req.headers.cookie); <<-- what should i do??
console.log(cookies);
// return localStorage.getItem('username') ? Promise.resolve() : Promise.reject()
// return Promise.resolve({ redirectTo: 'http://heimdall-local.dev.daumkakao.io' })
return Promise.resolve();
},
getPermissions: () => Promise.reject('Unknown method'),
getIdentity: () =>
Promise.resolve({
id: 'user',
fullName: 'Jane Doe',
avatar:
}),
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
