mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
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:
commit
8fb85f9c67
3 changed files with 7 additions and 26 deletions
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue