Skip to content

Conversation

@archiewood
Copy link
Member

@archiewood archiewood commented Feb 7, 2025

This is a working version of auth without needing to copy and paste a token into the terminal

Considerations:

  • From a UX experience, this feels much cleaner to me
  • We no longer print the auth url into the terminal
  • We no longer let users copy paste into the terminal
    • The upshot of this, is that if the user does not get the browser popup (i am not sure how robust this browser opening process is), then they will hang forever without having any recourse for action
CleanShot.2025-02-07.at.12.56.01.mp4

@archiewood
Copy link
Member Author

oh good i broke windows

@Alex-Monahan
Copy link
Contributor

oh good i broke windows

If os=windows, use old way. Else, use new nice way... ;-)

@archiewood
Copy link
Member Author

Windows build error

D:\a\duckdb_gsheets\duckdb_gsheets\src\gsheets_auth.cpp(9,10): fatal error C1083: Cannot open include file: 'sys/socket.h': No such file or directory

@Alex-Monahan
Copy link
Contributor

New error is:

D:\a\duckdb_gsheets\duckdb_gsheets\src\gsheets_auth.cpp(130,12): error C2664: 'int setsockopt(SOCKET,int,int,const char *,int)': cannot convert argument 4 from 'int *' to 'const char *' [D:\a\duckdb_gsheets\duckdb_gsheets\build\release\extension\gsheets\gsheets_extension.vcxproj]
D:\a\duckdb_gsheets\duckdb_gsheets\src\gsheets_auth.cpp(130,61): message : Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast [D:\a\duckdb_gsheets\duckdb_gsheets\build\release\extension\gsheets\gsheets_extension.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\winsock2.h(2133,1): message : see declaration of 'setsockopt' [D:\a\duckdb_gsheets\duckdb_gsheets\build\release\extension\gsheets\gsheets_extension.vcxproj]

@Alex-Monahan
Copy link
Contributor

I think this might be an example that would work!
https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-setsockopt

    BOOL bOptVal = TRUE;

    iResult = setsockopt(ListenSocket, SOL_SOCKET, SO_KEEPALIVE, (char *) &bOptVal, bOptLen);
    if (iResult == SOCKET_ERROR) {
        wprintf(L"setsockopt for SO_KEEPALIVE failed with error: %u\n", WSAGetLastError());
    } else
        wprintf(L"Set SO_KEEPALIVE: ON\n");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants