I am writing a React Native app.
I am trying to authenticate using Keycloak.
I am using the react-keycloak
library.
Here's my code:
import Keycloak from "keycloak-js";
import { KeycloakProvider } from "react-keycloak";
import keycloak_config from "./config/keycloak.json";
const keycloak = new Keycloak(keycloak_config);
This is throwing the following error:
However, this is quite literally how the docs for this library suggest to use it, and I have tested it previously in other projects and it works fine.
What is going on here? Is it a react native issue specifically?
I was asked for keycloak.json, so here it is:
keycloak.json:
{
"resource": "client-name",
"realm": "realm-name",
"ssl-required": "external",
"public-client": true,
"confidential-port": 0,
"clientId": "client-name",
"url": "https://example-domain-here.com/auth",
"auth-server-url": "https://example-domain-here.com/auth",
"credentials": {
"secret": "alphanumeric-hash-from-keycloak"
}
}