sourcery-ai / sourcery

Instant AI code reviews
https://sourcery.ai
MIT License
1.54k stars 68 forks source link

Sourcery Login issues #366

Open sureshbabu-nair opened 1 year ago

sureshbabu-nair commented 1 year ago

Checklist

Description

I have been trying to use sourcery on my office laptop (MacOS Ventura) without much success, but I am able to login from my personal devices. I am tried using both the web-browser code method as well as using the token, I am not sure whats preventing my access.

I am getting this error from the command line

suresh$ sourcery login --token user_orEywFeB0It1ynbQelvlZ_JUe7z1W9AjXRJsvwY3ftD_wCaolyWo3WsUJLc Sourcery requires a token. Visit our website to get yours free Failed to log in, please try again.

suresh$ sourcery login Your browser will be opened to visit: https://auth.sourcery.ai/activate?user_code=JXHR-CHWB

Ensure that the following code is displayed: JXHR-CHWB

Failed to fetch token: {"error":{"message":"You did not provide authentication. You need to provide the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY').","type":"unauthorized"}} Failed to log in, please try again.

I am having similar errors from Pycharm and vscode. But when I used my personal devices (Windows 10 & MacOS Catalina), I am able to login without a problem with both the methods, token & web browser on IDEs as well as commandline.

I even tried to use one of my personal device as a proxy, in case, if there was a firewall issues on my Office Laptop

Code snippet that reproduces issue

Sourcery requires a token. Visit our website to get yours free
Failed to log in, please try again.

suresh$  sourcery login
Your browser will be opened to visit: https://auth.sourcery.ai/activate?user_code=JXHR-CHWB

Ensure that the following code is displayed: JXHR-CHWB

Failed to fetch token: {"error":{"message":"You did not provide authentication. You need to provide the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY').","type":"unauthorized"}}
Failed to log in, please try again.

Debug Information

IDE Version: PyCharm Community Edition 2023.1.4 , VS Code (Version: 1.80.1) as well as Python Module, sourcery (1.6.0)

Sourcery Version: v1.6.0

Operating system and Version: MacOS Ventura 13.4.1

reka commented 1 year ago

Thanks a lot for reporting this issue.

Can you please try the following steps from the MacOS Ventura device?

  1. Visit https://api.sourcery.ai/health in a browser.
  2. Run sourcery --verify from the command line.

Do these work?

sureshbabu-nair commented 1 year ago

Hi Reka,

As per your instructions, I did the following

  1. Visit https://api.sourcery.ai/health in a browser. Shows healthy

2 Run sourcery --verify from the command line. suresh$ sourcery --verify sourcery, version 1.6.0

Verifying user config /Users/suresh/.config/sourcery/sourcery.yaml - success Verifying server availability https://api.sourcery.ai/health - success Verifying refactoring functionality - success Verifying local database - success

reka commented 1 year ago

Thanks so much for the verifying steps. :+1:

It seems that you can basically reach Sourcery, but the login doesn't work. :thinking:

  1. Log Files Can you please send us your sourcery.log file from the MacOS Ventura work device? It should be located at ~/Library/Application Support/sourcery/sourcery.log You can send them in email to support@sourcery.ai

  2. Firewall Is it possible that your MacOS Ventura work device has a firewall set up? If yes, please try running Sourcery using a proxy. You can find information about the Proxy Configuration in the docs: https://docs.sourcery.ai/Reference/Configuration/Proxy/

sureshbabu-nair commented 1 year ago

Hi Reka,

The answer to your second question is that I already tested using proxy server. I ran a unsecured squid proxy on my personal device, configured the proxy settings for sourcery and still I got the same errors,

when I used the token: Sourcery requires a token. Visit our website to get yours free

when I used the plan login command (redirected via my browser): Failed to fetch token: {"error":{"message":"You did not provide authentication. You need to provide the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY').","type":"unauthorized"}}

I will send the sourcery.log soon.