Skip to content

Commit

Permalink
Merge pull request #640 from Stremio/refactor/intro-ctx-facebook-auth
Browse files Browse the repository at this point in the history
refactor(Intro): use Facebook type for ctx Authenticate action
  • Loading branch information
tymmesyde authored Jul 23, 2024
2 parents 7a1597e + 69a1a8b commit 8fb85f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 2 additions & 21 deletions src/routes/Intro/Intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
});
Expand Down

0 comments on commit 8fb85f9

Please sign in to comment.