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:
- 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.
- 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
Description
When working on self hosting, i found that when generating oauth token, the endpoint will return error about planIdsToClientCapabilities
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:
Since these requirements
config.subscriptions && config.subscriptions.stripeApiKeyandconfig.cms.enabled || (config.cms.strapiClient && config.cms.strapiClient.graphqlApiUri && config.cms.strapiClient.apiKey && config.cms.strapiClient.firestoreCacheCollectionNamein key_server.js prevents capabilityManager being instantiated.According to scope docs , when Firefox browser send scope
profilewhich will definitely hitcapabilityService.subscriptionCapabilitiesin oauth/grant.js:generateAccessToken sinceprofile:subscriptionsis a sub-scope ofprofileand 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