Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Don't rely on an intermediary server for logging in #31

Open
moeenio opened this issue Apr 27, 2021 · 33 comments
Open

[feat] Don't rely on an intermediary server for logging in #31

moeenio opened this issue Apr 27, 2021 · 33 comments
Labels
backlog Stuff that won't be focused on until V1 release on Google Play enhancement New feature or request help wanted Extra attention is needed priority : will security

Comments

@moeenio
Copy link
Member

moeenio commented Apr 27, 2021

As discussed in #30 with @Semisol It would be better to bypass CORS restrictions and log in to Scratch directly than use an intermediary api server that gets your password. This can be done with a capacitor plugin as shown in this article. This desn't remove the need to write a pirvacy policy, though.

@micahlt

@moeenio moeenio added help wanted Extra attention is needed enhancement New feature or request security labels Apr 27, 2021
@micahlt
Copy link
Member

micahlt commented Apr 27, 2021

Agreed. The only downside of implementing the HTTP capacitor plugin would be that the app can no longer be tested in the browser because of CORS restrictions. That will rapidly slow down development. I'll look into it and see if I can find a method of doing it.

@Semisol
Copy link

Semisol commented Apr 27, 2021

Agreed. The only downside of implementing the HTTP capacitor plugin would be that the app can no longer be tested in the browser because of CORS restrictions. That will rapidly slow down development. I'll look into it and see if I can find a method of doing it.

Well do you know that there is something called a browser extension to temporarily disable CORS and also a custom backend option for testing on desktop?

@micahlt
Copy link
Member

micahlt commented Apr 27, 2021

@Semisol Ah, all righty. Guess I'll work on implementing this ASAP and updating the docs to reflect the changes.

@moeenio
Copy link
Member Author

moeenio commented Apr 27, 2021

If we don't want to rely on the server for logging in, we shouldn't rely on it for actions that need a token too huh?

@micahlt
Copy link
Member

micahlt commented Apr 27, 2021

@locness3 Maybe, or maybe not. That would solve rate limiting issues we'd have when using a single server. However, for my wrapped API's that I'm working on (like studios, for example, which don't even have a JSON-based API), that could dramatically increase the app's file size.

@moeenio
Copy link
Member Author

moeenio commented Apr 27, 2021

I think it's ok to rely on the server for public data. for anything private (including actions on public things) the app should do it directly; a token is as powerful as a password.

@micahlt
Copy link
Member

micahlt commented Apr 27, 2021

That's fair. I can attempt to integrate my studio wrapper directly into the app.

@micahlt
Copy link
Member

micahlt commented Jul 18, 2021

Unless anyone else is willing to work on this, I'm going to have to leave this as it is. For some reason I absolutely cannot get auth working with the Capacitor HTTP plugin. I've been working on this one issue for around one and a half months, and it's gotten me very burnt-out. For now, login will go to the server which will send the x-token back to the client where it will be used to authenticate other requests directly to Scratch.

@moeenio
Copy link
Member Author

moeenio commented Jul 19, 2021

what about you learn java or kotlin?

@micahlt
Copy link
Member

micahlt commented Jul 19, 2021

I really don't have the time or resources to learn an entirely new programming language, and I'm definitely not starting over Itchy for a third time.

@moeenio
Copy link
Member Author

moeenio commented Jul 19, 2021

I still have to do it then.

But trust me when I say that Java is easy to grasp from JavaScript.

@micahlt
Copy link
Member

micahlt commented Jul 19, 2021

I still have to do it then.

What do you mean?

@moeenio
Copy link
Member Author

moeenio commented Jul 19, 2021

Making a native client... maybe not.

@micahlt
Copy link
Member

micahlt commented Jul 19, 2021

Oh my - good luck with that! 😣

@moeenio
Copy link
Member Author

moeenio commented Jul 20, 2021

Lmao

@micahlt
Copy link
Member

micahlt commented Oct 2, 2021

I'm putting this in the backlog - this doesn't harm the user experience and I cannot get this to work.

@micahlt micahlt added the backlog Stuff that won't be focused on until V1 release on Google Play label Oct 2, 2021
@moeenio
Copy link
Member Author

moeenio commented Oct 3, 2021

every task on this project be like

@micahlt
Copy link
Member

micahlt commented Oct 3, 2021

every task on this project be like

Not really - I'm still hard at work on getting this released before 2022. I don't care if anyone else contributes anymore. No one except you seems to actually contribute anything to the project.

@moeenio
Copy link
Member Author

moeenio commented Oct 3, 2021

No one except you seems to actually contribute anything to the project.

True. Advertise!

@micahlt
Copy link
Member

micahlt commented Oct 3, 2021

No one except you seems to actually contribute anything to the project.

True. Advertise!

What do you think all my Scratch projects are doing lol

@moeenio moeenio added bug Something isn't working and removed enhancement New feature or request backlog Stuff that won't be focused on until V1 release on Google Play labels Feb 16, 2022
@moeenio
Copy link
Member Author

moeenio commented Feb 16, 2022

I've changed the labels since I consider this to be an important security bug. Feel free to change them back.

@micahlt
Copy link
Member

micahlt commented Feb 16, 2022

Are you going to pursue this issue? Also, this isn't a bug - it's a workaround. There's a difference.

@moeenio
Copy link
Member Author

moeenio commented Feb 16, 2022

Are you going to pursue this issue?

Wdym?

Also, this isn't a bug - it's a workaround.

Sure.

@micahlt micahlt added enhancement New feature or request priority : should and removed bug Something isn't working priority : should labels Feb 20, 2022
@micahlt
Copy link
Member

micahlt commented Feb 20, 2022

Are you going to pursue this issue?

Wdym?

Are you going to work on this? I've already put forth my best effort and made exactly 0 progress.

@moeenio
Copy link
Member Author

moeenio commented Feb 20, 2022

Possibly.

@Semisol
Copy link

Semisol commented Feb 20, 2022

I do not know how any of this native stuff works. All I have to say is I would not want to trust my token with a service, and others would not too.

@micahlt
Copy link
Member

micahlt commented Feb 21, 2022

@Semisol I'm sure, which is why signing in to Itchy is completely optional. The only explanation I can give you is that instead of using JavaScript's native fetch API, we're using Capacitor HTTP which is supposed to make the requests through native Java code, therefore bypassing CORS requirements of the Scratch API. However, it's not a perfect plugin and some things just won't work. I've duplicated the login request exactly as used in itchy-api using the Capacitor HTTP plugin, and it won't work (e.g., gives 403 errors on request). I can, however, reassure you that the current auth server (itchy-api) is completely open-source and hosted on a secure platform (Vercel) that logs no private information.

@moeenio
Copy link
Member Author

moeenio commented Feb 21, 2022

Did you try to reach out to the devs of the Capacitor plugin?

Also : is it not possible to test the app in the browser anymore with the http plugin? would using a proxy depending on the detected platform be a solution?

@micahlt
Copy link
Member

micahlt commented Feb 21, 2022

Did you try to reach out to the devs of the Capacitor plugin?

Yes, I have. From their testing, cookies are working fine (which is the issue I'm encountering). I suspect it's partially an issue on Scratch's side.

is it not possible to test the app in the browser anymore with the http plugin?

My current method of testing online is with a CORS-bypassing extension that automatically proxies requests when turned on.

@moeenio
Copy link
Member Author

moeenio commented Feb 23, 2022

My current method of testing online is with a CORS-bypassing extension that automatically proxies requests when turned on.

Right, didn't think of that - not sure if cookies would work with this?

@micahlt
Copy link
Member

micahlt commented Feb 23, 2022

Not sure either - which is why during development I generally just use Capacitor hot-reloading over ADB with my phone rather than the browser.

@moeenio
Copy link
Member Author

moeenio commented Feb 25, 2022

That's useful, however it requires the android sdk

@micahlt
Copy link
Member

micahlt commented Feb 25, 2022

That's useful, however it requires the android sdk

Lol of course - this project is an Android app.

@micahlt micahlt changed the title Don't rely on an intermediary server for logging in [feat] Don't rely on an intermediary server for logging in Feb 26, 2022
@micahlt micahlt added the backlog Stuff that won't be focused on until V1 release on Google Play label Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Stuff that won't be focused on until V1 release on Google Play enhancement New feature or request help wanted Extra attention is needed priority : will security
Projects
None yet
Development

No branches or pull requests

3 participants