guardian / dotcom-rendering

The Guardian web rendering service (aka DCR/DCAR)
https://www.theguardian.com
Apache License 2.0
253 stars 30 forks source link

[Epic] Refactor discussion to use Bridget API on apps #9869

Closed georgeblahblah closed 4 months ago

georgeblahblah commented 10 months ago

What needs to happen

We should refactor the discussion components so that they can use Bridget APIs instead of Discussion API on apps articles for certain functionality. This is because the apps webview doesn't have the authentication cookie or okta token for the authenticated discussion API endpoints.

Background

Discussion API

On web, the discussion API provides endpoints for the following actions:

unauthenticated endpoints

authenticated endpoints

these endpoints are authenticated by cookie or okta auth token

On apps

The apps journey is slightly different, as the webview doesn't have knowledge of the user's identity. It doesn't have the GU_U cookie or the okta token, and so calls to the authenticated discussion endpoints will fail.

Instead, Bridget provides a discussion service which exposes some endpoints for similar functionality:

https://github.com/guardian/bridget/blob/88c99c6f311f00db6dab4daf88b9bdcf25225666/thrift/native.thrift#L122-L128

Update 12/02/24

## Tasks
- [ ] #10544
- [ ] #10325
- [ ] #10326 
mxdvl commented 9 months ago

Three implementations:

georgeblahblah commented 8 months ago

There will be a specific app version (or greater) that supports discussion with Bridget in iOS (and probably Android too), even though the Bridget API has not changed. Given the only mechanism that MAPI has is to specify a required Bridget version for a given piece of content, I suggest that we:

georgeblahblah commented 8 months ago

I wonder what we should do with the "sign in copy" on Discussion on apps, and more broadly, the "user is not signed in" scenario:

The current behaviour on the embedded templates is:

Options: