Google authentication on desktop doesn't work
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17k
- Forks
- 694
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 33
Description
Exception: oauthAuthorize command is not supported.
PS C:\Users\Desktop\Projects> & c:/Users/Desktop/Projects/.venv/Scripts/python.exe c:/Users/Desktop/Projects/main.py
Future exception was never retrieved
future: <Future finished exception=Exception('oauthAuthorize command is not supported.')>
Traceback (most recent call last):
File "C:\Program Files\Python312\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\Desktop\Projects\main.py", line 18, in login_click
page.login(provider)
File "C:\Users\Desktop\Projects\.venv\Lib\site-packages\flet_core\page.py", line 565, in login
result = self._send_command("oauthAuthorize", attrs=auth_attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Desktop\Projects\.venv\Lib\site-packages\flet_core\page.py", line 704, in _send_command
return self.__conn.send_command(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Desktop\Projects\.venv\Lib\site-packages\flet_runtime\flet_socket_server.py", line 155, in send_command
result, message = self._process_command(command)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Desktop\Projects\.venv\Lib\site-packages\flet_core\local_connection.py", line 103, in _process_command
return self._process_oauth_authorize_command(command.attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Desktop\Projects\.venv\Lib\site-packages\flet_core\local_connection.py", line 221, in _process_oauth_authorize_command
raise Exception("oauthAuthorize command is not supported.")
Exception: oauthAuthorize command is not supported.
PS C:\Users\Desktop\Projects>
Code : main.py
import flet as ft
from flet.auth.providers import GoogleOAuthProvider
CLIENT_ID = '***********.apps.googleusercontent.com'
CLIENT_SECRET = '*********'
def main(page: ft.Page):
provider = GoogleOAuthProvider(
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
redirect_url="http://localhost:8550/oauth_callback",
)
def login_click(e):
page.login(provider)
data = ft.Column()
def on_login(e):
print("Login error:", e.error)
print("Access token:", page.auth.token.access_token)
print("User ID:", page.auth.user.id)
data.controls.append(
ft.Column([
ft.Text(f"Name:, {page.auth.user["name"]}"),
ft.Text(f"Email:, {page.auth.user["email"]}"),
])
)
page.update()
page.on_login = on_login
page.add(
ft.Column([
ft.Text('Login', size=20),
ft.ElevatedButton("Login", on_click=login_click),
data,
]))
ft.app(target=main)
Description :
I want to create a small data entry desktop app that save data to google sheet using google sheet API. So, in oder the API to work we need authorization flow but when I use google auth in this exemple to get the credentials, the code raises this issue, Please How I can Fix this.
Note : I want this app to work on both Mobile and desktop.
flet version : 0.21.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied main.py reproduction and the traceback path through flet_core/local_connection.py, especially _process_oauth_authorize_command. Check how the oauthAuthorize command is handled for desktop versus mobile, then verify that the Google login flow completes on desktop without raising the unsupported-command exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, python
- Domain
- authentication, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100