-
Notifications
You must be signed in to change notification settings - Fork 66
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
Incorrect access token should not be allowed #64
Comments
Hello @AvaniVerma I looked into this issue but I saw that you put v2 tag on it. In v2 you are using passport js and call However I assume you meant that this bug occurs in v1, which is true and can be fixed with a call to general github API url like before. Here is an example code: https://github.com/curiositylab/curiosity/blob/master/js/main.js#L93 const url = `https://api.github.com/?access_token=${token}`;
axios({
url,
method: 'get',
responseType: 'json',
}).then(() => {
localStorage.setItem('accessToken', token);
resolve();
}).catch(() => reject('Error: invalid token')); I also found a bug in v1 that when you write the token for the first time you don't save Would you like me to create a PR to fix it in v1 or v2 or maybe both? |
Doing a single PR for both will be better |
Hi @mubaris I don't really understand what you mean here by a single PR for both, the code for v1 and v2 is different now so it have to be separate commits (not cherrypicked) |
wouldn't it be nicer if an OAuth app would be set up? |
It should say in the README what scopes is required for the token. I can't find this information anywhere and it's very important. If a user doesn't know what scopes to give he/she might give all scopes which gives this application unnecessary power. |
Is this still open? |
@MehWhatever Yes |
@simeg You can create a token without any scopes |
so this is the function that calls for the projects for a specific user right? but the issue is that you are always getting fetching projects if a user provided an incorrect access token keep in mind that if you provided a incorrect access token then it should be appeared in the console.error that is inside of the axios catch first you should clear the child inside of the element searching so that the 'fetching products' text goes away https://www.w3schools.com/jsref/met_node_removechild.asp then you should insert in the inner html of searching 'incorrect access token' or 'something went wrong please try again!' so it should be something like this:
this is a basic example but if you want to be specific, you can either innerHTML the error being catched by axios or you can receive the error and do some validation hope my answer helped a bit |
Steps to reproduce
Result : We get a screen saying fetching results. However, all that happens is failed requests.
In ideal conditions, we should see an error and ask the user to re-enter the access token.
The text was updated successfully, but these errors were encountered: