Skip to content

Lacking of capabilityManager should not raise error #21079

Description

@jackyzy823

Description

When working on self hosting, i found that when generating oauth token, the endpoint will return error about planIdsToClientCapabilities

POST /v1/oauth/token HTTP/1.1
Host: api.fxa.example.local
authorization: Bearer fxs_xxxxx

which returns 500
{"code":500,"errno":998,"error":"Internal Server Error","message":"An internal validation check failed.","info":"https://mozilla.github.io/ecosystem-platform/api#section/Response-format","op":"planIdsToClientCapabilities","data":{}}


some digging and background:

  1. For selfhosting, capabilityManager is not instantiated.

Since these requirements config.subscriptions && config.subscriptions.stripeApiKey and config.cms.enabled || (config.cms.strapiClient && config.cms.strapiClient.graphqlApiUri && config.cms.strapiClient.apiKey && config.cms.strapiClient.firestoreCacheCollectionName in key_server.js prevents capabilityManager being instantiated.

  1. planIdsToClientCapabilities is not skipable too.

According to scope docs , when Firefox browser send scope profile which will definitely hit capabilityService.subscriptionCapabilities in oauth/grant.js:generateAccessToken since profile:subscriptions is a sub-scope of profile
and planIdsToClientCapabilities will be called, and then error happens.

So there's nothing self-hosting side can do (except patching these code).

What should happen?

/v1/oauth/token should return token whether capabilityManager is available or not

Actual result

500 Internal Server Error

Environment

Firefox 154.0

┆Issue is synchronized with this Jira Task

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions