# Bug OP-17517 - Auth providers registered via the AuthPlugin API (register_auth_providers) broken with 16.2 provider link changes

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-17517

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Authentication |
| Target versions | 16.2.1 |
| Observed in versions | 16.2.0 |
| Sprint | 16.2.1 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 16.2.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

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

## Planning

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

## Costs

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

## Description

### Steps to reproduce

1.  In OpenProject \<= 16.1, configure an OpenProject plugin, which uses `register_auth_providers`, such as [openproject-auth\_cas](https://github.com/oliverguenther/openproject-auth_cas/blob/dev/lib/open_project/auth_cas/engine.rb)

2.  Update to OpenProject 16.2

3.  Try logging in using that auth provider

### What is the buggy behavior?

  - When returning from the auth provider (IdP) (to /auth/:provider/callback), you get a 404 page not found error in a flash message

### What is the expected behavior?

  - The login should work

**OpenProject version**

*v16.2.0*

### Remarks

  - the 404 error is caused [here](https://github.com/opf/openproject/blob/release/16.2/app/services/user_auth_provider_links_setter.rb#L49)

  - but even without that the login would not work as we need to store what was formerly the identity\_url in the join table between users and auth providers (user\_auth\_provider\_links)

  - possible way around this:
    
      - when a plugin calls `register_auth_providers`, automatically create an `AuthProvider` record in the database
        
          - however this block is a lambda, meaning hypothetically providers can change arbitrarily, and exist or not exist accordingly on a per-request basis
