I need to obtain rpt in order to register new users in my app.
Keycloak.json
{
"realm": "master",
"auth-server-url" : "http://localhost:8180/auth",
"resource" : "admin-cli",
"public-client": true
}
Fetching the rpt:
@GetMapping("rpt")
public String token() {
var username = environment.getProperty("authServer.admin.username");
var password = environment.getProperty("authServer.admin.password");
var req = new AuthorizationRequest();
var res = this.authzClient.authorization(username, password).authorize(req);
return res.getToken();
}
I get:java.lang.RuntimeException: Client secret not provided.
But I am using admin-cli
that under the master realm which it's access type is public
.
Already I set:
"public-client": true
How can I obtain rpt of admin-cli
? I will use it to create new users in my applications register page.