Skip to content

无法跨域访问 #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chenxizhang opened this issue Feb 2, 2021 · 1 comment
Open

无法跨域访问 #12

chenxizhang opened this issue Feb 2, 2021 · 1 comment

Comments

@chenxizhang
Copy link

无法在javascript代码中调用接口

` const token =
"eyJhbGciOiJSUzI1NiIsImtpZCI6IjlFMjcyMkFGM0IzRTFDNzU5RTI3NEFBRDI5NDFBNzg1MDlCMDc2RDAiLCJ0eXAiOiJhdCtqd3QiLCJ4NXQiOiJuaWNpcnpzLUhIV2VKMHF0S1VHbmhRbXdkdEEifQ.eyJuYmYiOjE2MTIyMzU2MzAsImV4cCI6MTYxMjMyMjAzMCwiaXNzIjoiaHR0cDovL29wZW5hcGlfb2F1dGgtc2VydmVyIiwiYXVkIjoiQ25CbG9nc0FwaSIsImNsaWVudF9pZCI6IjQ0YzgxMjg1LWNiODMtNDJlMi05Y2Q3LWI2ZTFiZDY2NzQyNCIsImp0aSI6IjZGMTkxNEU4RDk5NUJGOUNFNUIwOTJCQ0E5NUE4MzAwIiwiaWF0IjoxNjEyMjM1NjMwLCJzY29wZSI6WyJDbkJsb2dzQXBpIl19.K9Rhsxvqv3bw3PFKULHoxPsZ0MUwkj1F--K4vg1bD6Ms5TxEu5SOUHyApiCGSCtyLhug2Y4H7OTCQETPIWUU3QL2f7BXXv8zclzBRvz85fFLMfmS4362ipa6e778xIACbIl7Gs8ag2ZQW8l86ZSJ6ZiWB7Qi8qLOoZpi5w_X_hjy9ACoUBHr_451LuNSoc8ZRbmnqD83nO3GrFRG2wIaAl2r9DvXBpIkwZsz0l4ynRIS5mixEz9J7jEH0A6OWdCAl7zpFUHOY8yzy5SsRC5FWhpy4-dFnaWDt2eqXML7lQ-_h83zB8DkLUMRkJ-ein0GfHd6N-DFRaR_gXbujWgrCg";

fetch("https://api.cnblogs.com/api/blogs/chenxizhang", {
headers: {
Authorization: bearer ${token},
},
}).then((res) => console.log(res));
`

@cnblogs-dudu
Copy link
Contributor

在 IdentityServer 的 ClientCorsOrigins 表中添加了跨域授权

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants