The /oauth/userinfo is apparently not there. You can get the user information using OpenShift API itself /apis/user.openshift.io/v1/users/{name}
The thing that I was missing is that a current logged in user is returned when you put ~ (tilde) to the path, so GET /apis/user.openshift.io/v1/users/~
{
kind: "User",
apiVersion: "user.openshift.io/v1",
metadata: {
name: "kube:admin",
selfLink: "/apis/user.openshift.io/v1/users/kube%3Aadmin",
creationTimestamp: null,
},
identities: null,
groups: [
"system:authenticated",
"system:cluster-admins",
],
}
As I'm using CodeReady containers for the development, I have URLs set up like this (Node.js/Next.js/next-auth):
export const OpenShiftOAuthProvider = {
id: "openshift",
name: "OpenShift",
type: "oauth",
version: "2.0",
params: { grant_type: "authorization_code" },
scope: "user:full",
idToken: false,
accessTokenUrl: "https://oauth-openshift.apps-crc.testing/oauth/token",
profileUrl: "https://api.crc.testing:6443/apis/user.openshift.io/v1/users/~",
authorizationUrl:
"https://oauth-openshift.apps-crc.testing/oauth/authorize?response_type=code",
clientId: "<yourclientid>",
clientSecret: "<yourclientsecret>"
async profile(profile) {
return {
id: profile.metadata.name,
name: profile.metadata.name
};
},
};