czetsuya / Spring-Keycloak-with-REST-API

Securing a Spring REST API with Keycloak with bearer-only=true.
12 stars 13 forks source link

primereact-app-realm.json can't import to keycloak #1

Closed lewis-ing closed 4 years ago

lewis-ing commented 4 years ago

this is error info: image

czetsuya commented 4 years ago

Hi, it would help if you can share a part of your server log. But a common issue would be an incompatible Keycloak version.

lewis-ing commented 4 years ago

this is error log:

image

czetsuya commented 4 years ago

Are you perhaps running Keycloak on Docker? Can you try downloading a new zipped version of Keycloak and try to import it there.

lewis-ing commented 4 years ago

No,I download Keycloak 8.0.1 version at windows,do you primereact-app-realm.json file,upload this.

czetsuya commented 4 years ago

Hmm. Can you try using version Keycloak server 6.0.1 and see if the same error will occur? I read somewhere that this feature has been removed from 7.0.0.

czetsuya commented 4 years ago

I think I figured out the problem it seems like Keycloak team has introduced the notion of feature and uploading the json file has become one of them. Sadly, it is disable by default. To enable realm upload run Keycloak like:

standalone.bat -Dkeycloak.profile.feature.upload_scripts=enabled

Here's the documentation: https://www.keycloak.org/docs/latest/server_installation/

lewis-ing commented 4 years ago

It's ok,using standalone.bat " -Dkeycloak.profile.feature.upload_scripts=enabled" for start cmd,

I run server and front,I tried to add customer info,yet exists error info, please error capture image,

image

czetsuya commented 4 years ago

That must be due to the Web Origins setting inside your Client. For testing purposes, you can set it to "". Set the valid redirect URLs to "" too. But don't forget to change them when you go live.

What is CORS? https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

lewis-ing commented 4 years ago

yes,I found it, should you setting "bearer-only" at keycloak "springboot-rest-api" for back server.

image

Thanks czetsuya.