Skip to content

[6.x] OAuth login button does nothing when clicked #13537

@msuphilipg

Description

@msuphilipg

Bug description

The OAuth login button on the CP login page (/cp/auth/login) doesn't navigate when clicked. Inspecting the HTML shows the button renders as <href>SSO</href> instead of <a href="">SSO</href>.

The issue appears to be in resources/js/pages/auth/Login.vue line 144:

<Button
    v-for="provider in providers"
    :key="provider.name"
    as="href"
    class="flex-1 [&_svg]:opacity-100!"
    :href="provider.url"
    :icon="provider.icon"
    :icon-only="!!provider.icon"
    v-tooltip="__('Sign in with :provider', { provider: provider.label })"
>
    <span class="sr-only">{{ __('Sign in with :provider', { provider: provider.label }) }}</span>
    <span v-if="!provider.icon">{{ provider.label }}</span>
</Button>

The as="href" prop is passed to the Button component which uses it as the element tag name. See resources/js/components/ui/Button/Button.vue lines 39-45:

const tag = computed(() => {
    if (props.as) return props.as;
    if (props.href) {
        return props.target === '_blank' ? 'a' : Link;
    }
    return 'button';
});

Expected: Clicking the OAuth button should navigate to /oauth/{provider}?redirect=/cp
Actual: Nothing happens

How to reproduce

  1. Configure and enable an OAuth provider
  2. Visit /cp/auth/login
  3. Click the OAuth button

Logs

Environment

Environment
Application Name: Website
Laravel Version: 12.46.0
PHP Version: 8.5.1
Composer Version: 2.9.2
Environment: local
Debug Mode: ENABLED
URL: website.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Cache: file
Database: mariadb
Logs: stack / daily
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 1
Sites: 812 (Graham, Batz and Stark, Baumbach, Welch and Hoppe, Gleason LLC, and 809 more)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.0.0-beta.1 PRO

Statamic Addons
statamic/eloquent-driver: dev-master

Statamic Eloquent Driver
Addon Settings: file
Asset Containers: eloquent
Assets: eloquent
Blueprints: eloquent
Collection Trees: eloquent
Collections: file
Entries: eloquent
Fieldsets: eloquent
Form Submissions: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: eloquent
Sites: eloquent
Taxonomies: eloquent
Terms: eloquent
Tokens: eloquent

Installation

Existing Laravel app

Additional details

Here is the rendered login button

<href 
  class="..." 
  disabled="false" 
  data-ui-group-target="true" 
  href="https://website.test/oauth/saml2?redirect=/cp">
    <div class="st-text-trim-start flex content-center">
      <span class="sr-only">Sign in with SSO</span><span>SSO</span>
    </div>
</href>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions