ory / kratos

Next-gen identity server replacing your Auth0, Okta, Firebase with hardened security and PassKeys, SMS, OIDC, Social Sign In, MFA, FIDO, TOTP and OTP, WebAuthn, passwordless and much more. Golang, headless, API-first. Available as a worry-free SaaS with the fairest pricing on the market!

Home Page:https://www.ory.sh/kratos/?utm_source=github&utm_medium=banner&utm_campaign=kratos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Social Account Linking

MUzairS15 opened this issue · comments

Preflight checklist

Ory Network Project

No response

Describe the bug

I am trying out Automatic social account linking flow, while I am able to complete the flow, there are few nuances during the flow.

  1. I already have a Kratos Identity (Username password).
  2. On the login screen I initiate Sign in with GitHub (which has the same email address as used while creating the Kratos Identity)
  3. After GitHub OAuth I get redirected to my Login page to enter my email and password.
    Bug 1: In the docs, it's mentioned I only need to enter my password, but I am asked to enter email address again.
    Bug 2: The message that get's displayed Signing in will link your account to \"<abc@gmail.com>\" at provider \"\". If you do not wish to link that account, please start a new login flow, it is missing the provider value. (Refer the JSON flow as recieved from the Kratos to render the login form).
    Bug 3: Why there's button for Sign in with github and link credential, when I initiated the flow by clicking on the Sign in with Github? Also clikcing on these buttons re-initiate the flow.
{
    "created_at": "2024-03-25T17:44:32.334498Z",
    "expires_at": "2024-03-26T05:44:32.333298Z",
    "id": "1c57ad4f-b4c6-4ac6-9895-8b2aa55d6fdb",
    "issued_at": "2024-03-25T17:44:32.333298Z",
    "refresh": false,
    "request_url": "http://localhost:9010/self-service/methods/oidc/callback/github?code=1f3e119fd0758607b6de\u0026return_to=%2Flogin%3Flogin_challenge%3D472c4458f7ef4f068a8400f038f8a13c\u0026state=Nzg3YjM4MzUtZDIxYS00MzkwLTgxNjMtZTZmMjQwMjNlY2ZkOnhkqGSXoE5LtbWcKnv7DcE",
    "requested_aal": "aal1",
    "return_to": "/login?login_challenge=472c4458f7ef4f068a8400f038f8a13c",
    "type": "browser",
    "ui": {
        "action": "http://localhost:9010/self-service/login?flow=1c57ad4f-b4c6-4ac6-9895-8b2aa55d6fdb",
        "messages": [
            {
                "id": 4000007,
                "text": "An account with the same identifier (email, phone, username, ...) exists already.",
                "type": "error"
            },
            {
                "context": {
                    "duplicateIdentifier": "abc@gmail.com",
                    "newLoginUrl": "http://localhost:9876/login",
                    "provider": ""
                },
                "id": 1010016,
                "text": "Signing in will link your account to \"abc@gmail.com\" at provider \"\". If you do not wish to link that account, please start a new login flow.",
                "type": "info"
            }
        ],
        "method": "POST",
        "nodes": [
            {
                "attributes": {
                    "disabled": false,
                    "name": "provider",
                    "node_type": "input",
                    "type": "submit",
                    "value": "github"
                },
                "group": "oidc",
                "messages": [],
                "meta": {
                    "label": {
                        "context": {
                            "provider": "github"
                        },
                        "id": 1010018,
                        "text": "Sign in with github and link credential",
                        "type": "info"
                    }
                },
                "type": "input"
            },
            {
                "attributes": {
                    "disabled": false,
                    "name": "provider",
                    "node_type": "input",
                    "type": "submit",
                    "value": "google"
                },
                "group": "oidc",
                "messages": [],
                "meta": {
                    "label": {
                        "context": {
                            "provider": "google"
                        },
                        "id": 1010018,
                        "text": "Sign in with google and link credential",
                        "type": "info"
                    }
                },
                "type": "input"
            },
            {
                "attributes": {
                    "disabled": false,
                    "name": "csrf_token",
                    "node_type": "input",
                    "required": true,
                    "type": "hidden",
                    "value": "QFaCQuMHPMYDwrD1HjzPFOxePFGbrg9OQZqD4ioVJwcXrdkWBopdmUoty4UvOD67U96NDfUC0qDZ9dRn6dUM6g=="
                },
                "group": "default",
                "messages": [],
                "meta": {},
                "type": "input"
            },
            {
                "attributes": {
                    "disabled": false,
                    "name": "identifier",
                    "node_type": "input",
                    "required": true,
                    "type": "text",
                    "value": ""
                },
                "group": "default",
                "messages": [],
                "meta": {
                    "label": {
                        "context": {
                            "title": "E-Mail"
                        },
                        "id": 1070002,
                        "text": "E-Mail",
                        "type": "info"
                    }
                },
                "type": "input"
            },
        {
                "attributes": {
                    "autocomplete": "current-password",
                    "disabled": false,
                    "name": "password",
                    "node_type": "input",
                    "required": true,
                    "type": "password"
                },
                "group": "password",
                "messages": [],
                "meta": {
                    "label": {
                        "id": 1070001,
                        "text": "Password",
                        "type": "info"
                    }
                },
                "type": "input"
            },
            {
                "attributes": {
                    "disabled": false,
                    "name": "method",
                    "node_type": "input",
                    "type": "submit",
                    "value": "password"
                },
                "group": "password",
                "messages": [],
                "meta": {
                    "label": {
                        "id": 1010017,
                        "text": "Sign in and link",
                        "type": "info"
                    }
                },
                "type": "input"
            }
        ]
    },
    "updated_at": "2024-03-25T17:44:32.334498Z"
}

Reproducing the bug

Run kratos with GitHub and Google social provider enabled as docker containers.

Relevant log output

No response

Relevant configuration

No response

Version

v1.1.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Docker

Additional Context

No response