Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Social Connection Identity Linking API Inconsistency #6947

Open
2 tasks done
suin opened this issue Jan 16, 2025 · 0 comments
Open
2 tasks done

bug: Social Connection Identity Linking API Inconsistency #6947

suin opened this issue Jan 16, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@suin
Copy link

suin commented Jan 16, 2025

Describe the bug

The API endpoint for linking social identities shows inconsistencies between documentation and implementation:

  1. Documentation specifies PATCH /api/my-account/identities
  2. API returns Allow: POST header and 405 Method Not Allowed for PATCH
  3. Using POST method results in 401 Unauthorized with verification_record.permission_denied

This makes it impossible to complete the social connection linking flow.

Expected behavior

Either:

  • The API should accept PATCH method as documented, or
  • POST method should work properly if that's the intended design

How to reproduce?

  1. Request authorization URL:
POST /api/verifications/social
Authorization: Bearer <token>

{
  "connectorId": "github",
  "redirectUri": "http://localhost:3000/callback/github",
  "state": "asdfassdfafasd"
}

→ Returns 201 with verification record ID

  1. Complete GitHub OAuth flow and receive callback code

  2. Verify the social connection:

POST /api/verifications/social/verify
Authorization: Bearer <token>
{
  "connectorData": {
    "code": "<auth_code>",
    "state": "asdfassdfafasd"
  },
  "verificationRecordId": "<record_id>"
}

→ Returns 200 OK

  1. Try to link identity with PATCH (as per documentation):
PATCH /api/my-account/identities
Authorization: Bearer <token>
logto-verification-id: <record_id>
{
  "newIdentifierVerificationRecordId": "<record_id>"
}

→ Returns 405 Method Not Allowed

  1. Try with POST (as suggested by Allow header):
POST /api/my-account/identities
Authorization: Bearer <token>
logto-verification-id: <record_id>
{
  "newIdentifierVerificationRecordId": "<record_id>"
}

→ Returns 401 Unauthorized (verification_record.permission_denied)

Context

  • Self-hosted, Logto version = v1.23.0
    • Container (Docker image)
@suin suin added the bug Something isn't working label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant