Merge pull request #640 from Stremio/refactor/intro-ctx-facebook-auth

refactor(Intro): use Facebook type for ctx Authenticate action
This commit is contained in:
Tim 2024-07-23 16:56:30 +02:00 committed by GitHub
commit 8fb85f9c67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 26 deletions

8
package-lock.json generated
View file

@ -12,7 +12,7 @@
"@babel/runtime": "7.16.0",
"@sentry/browser": "6.13.3",
"@stremio/stremio-colors": "5.0.1",
"@stremio/stremio-core-web": "0.47.2",
"@stremio/stremio-core-web": "0.47.7",
"@stremio/stremio-icons": "5.2.0",
"@stremio/stremio-video": "0.0.38",
"a-color-picker": "1.2.1",
@ -2971,9 +2971,9 @@
"license": "MIT"
},
"node_modules/@stremio/stremio-core-web": {
"version": "0.47.2",
"resolved": "https://registry.npmjs.org/@stremio/stremio-core-web/-/stremio-core-web-0.47.2.tgz",
"integrity": "sha512-kJXkshXT5f5go137id9MHrVA7PfHao2pGSxfEBbMDGFCqAVfF4jRFTXmfLC0cS1R+EjYhajUrSsXnEddtb2c7g==",
"version": "0.47.7",
"resolved": "https://registry.npmjs.org/@stremio/stremio-core-web/-/stremio-core-web-0.47.7.tgz",
"integrity": "sha512-3hTie3Yx6198TY1rS2fdA5HKPmejqTDbE8C05+HdqM6oXor9TXVoSjY9AMPlSVUJvu40sP3oeenhe2MRBUQizw==",
"dependencies": {
"@babel/runtime": "7.24.1"
}

View file

@ -15,7 +15,7 @@
"@babel/runtime": "7.16.0",
"@sentry/browser": "6.13.3",
"@stremio/stremio-colors": "5.0.1",
"@stremio/stremio-core-web": "0.47.2",
"@stremio/stremio-core-web": "0.47.7",
"@stremio/stremio-icons": "5.2.0",
"@stremio/stremio-video": "0.0.38",
"a-color-picker": "1.2.1",

View file

@ -82,32 +82,13 @@ const Intro = ({ queryParams }) => {
openLoaderModal();
getFacebookToken()
.then((accessToken) => {
return fetch('https://www.strem.io/fb-login-with-token/' + encodeURIComponent(accessToken))
.then((resp) => resp.json())
.catch(() => {
throw new Error('Login failed at getting token from Stremio');
})
.then(({ user } = {}) => {
if (!user || typeof user.email !== 'string' || typeof user.fbLoginToken !== 'string') {
throw new Error('Login failed at getting token from Stremio');
}
return {
email: user.email,
password: user.fbLoginToken
};
});
})
.then(({ email, password }) => {
core.transport.dispatch({
action: 'Ctx',
args: {
action: 'Authenticate',
args: {
type: 'Login',
email,
password,
facebook: true
type: 'Facebook',
token: accessToken,
}
}
});