pulsejet / nextcloud-oidc-login

Nextcloud login via a single OpenID Connect 1.0 provider
https://apps.nextcloud.com/apps/oidc_login
GNU Affero General Public License v3.0
219 stars 61 forks source link

Issue with API Access After OIDC Integration with Keycloak #294

Open israfilalam22 opened 3 days ago

israfilalam22 commented 3 days ago

Need Help! I have successfully installed Nextcloud 30 and integrated it with Keycloak using the OpenID Connect Login app following the tutorial at (https://garagenum.gitlab.io/doc/divers/devops/sso/sso-nextcloud/). Users can log in successfully through the browser and access their Nextcloud drives without any issues.

I can retrieve user information using the Keycloak User Info endpoint at https://keycloak/realms/NextCloud/protocol/openid-connect/userinfo by using a Keycloak access token.

However, when I attempt to access the API endpoint /ocs/v2.php/cloud/users/user?format=json, I receive the error message: "Current user is not logged in."

Steps to Reproduce: Installed Nextcloud 30. Installed the OpenID Connect Login app. Configured integration with Keycloak. Logged in through the browser using Keycloak credentials. Attempted to access the API endpoint.

Expected Behavior: I expect to retrieve user information via the API after logging in successfully through the Keycloak access token.

Actual Behavior: The API responds with "Current user is not logged in."

Additional Information: The access token from Keycloak is being used in the request. I have verified that the user is logged in and can access the Nextcloud interface. I Any assistance or guidance on resolving this issue would be greatly appreciated!

Here my Config.php file: <?php $CONFIG = array( 'instanceid' => 'oc347baydoo2', 'passwordsalt' => '##########', 'secret' => '###############', 'trusteddomains' => array( 'domain', ), 'datadirectory' => '/var/www/nextcloud/data', 'dbtype' => 'mysql', 'version' => '30.0.0.14', 'overwrite.cli.url' => 'https://domain', 'dbname' => 'testdb', 'dbhost' => 'db host', 'dbtableprefix' => 'oc', 'mysql.utf8mb4' => true, 'dbuser' => 'root', 'dbpassword' => 'password', 'installed' => true, 'app_install_overwrite' => array( 'oidc_login', ), 'allow_user_to_change_display_name' => false, 'oidc_login_provider_url' => 'https://keycloak/realms/NextCloud', 'oidc_login_client_id' => 'uat-test-apps', 'oidc_login_client_secret' => '################', 'oidc_login_auto_redirect' => false, 'oidc_login_button_text' => 'OIDC-LOgin', 'oidc_login_attributes' => array( 'id' => 'preferred_username', 'name' => 'name', 'mail' => 'email', 'quota' => 'ownCloudQuota', 'home' => 'homeDirectory', 'ldap_uid' => 'uid', 'groups' => 'ownCloudGroups', ), 'oidc_login_default_group' => 'oidc', 'oidc_login_use_external_storage' => false, 'oidc_login_scope' => 'openid email profile', 'oidc_login_proxy_ldap' => false, 'oidc_login_disable_registration' => false, 'oidc_login_redir_fallback' => true, 'oidc_login_tls_verify' => true, 'oidc_login_webdav_enabled' => true, 'oidc_login_api_access_token_authentication' => true, 'maintenance' => false, 'loglevel' => 2, );

Thank you!

access-token

user-info

israfilalam22 commented 1 day ago

access-token user-info