# Bug NEX-639 - Do not create OAuth client while updating to OIDC auth method

Project: Stream Nextcloud app "OpenProject Integration"
Status: closed
URL: https://community.openproject.org/work_packages/NEX-639

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | Nextcloud Integration 2.11.4 |
| Observed in versions |  |
| Bug found in version (deprecated) |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

Nextcloud OAuth client is created all the time with the integration config update request. OAuth client creation is not required for the OIDC auth method.

PATCH `/setup` {...}

<br>

### Test Steps

1.  OAuth setup
    

```bash
curl -XPATCH 'http://{nc-server}/index.php/apps/integration_openproject/setup' \                                                                   
-H'Content-Type: application/json' \
-d'{
 "values":{
  "openproject_client_id": "client-id-new",
  "openproject_client_secret": "client-secret-new"
 }
}' \           
-u admin:admin
```

Check the following response:

```text
{
  "status": ...
  "nextcloud_oauth_client_name": ...
  "openproject_redirect_uri": ...
  "nextcloud_client_id": ...
  "nextcloud_client_secret": ...
}
```

2\. OIDC setup

```bash
curl -XPATCH 'http://{nc-server}/index.php/apps/integration_openproject/setup' \                                                                   
-H'Content-Type: application/json' \
-d'{
 "values":{
  "authorization_method": "oidc",
  "sso_provider_type": "external",
  "oidc_provider": "Keycloak",
  "token_exchange": false
 }
}' \           
-u admin:admin
```

Check the following response:

```text
{
  "status": ...
}
```
