-
Notifications
You must be signed in to change notification settings - Fork 275
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
Bug: OAuth Callback Authorization Error on Sign-in #235
Comments
Thanks for this @jacksonkasi1 - Going to look into it. |
I'm curious if/how this issue was resolved because I'm running into a similar issue for an Electron desktop app that wraps an existing web app. The existing web app has been working in production. I have implemented custom protocol routing to an internal server via HTTP, and updated allowed_origins. I can authenticate to Clerk (environment and client endpoints return 200), but after Google SSO the oauth_callback has the same behavior as OP. In staging environment, it works. In production environment, it doesn't. Is this due to some differences between the environments? The configuration is very similar, but maybe there's stricter security policies in production preventing the Electron app from working? |
@encryptedcommerce take a look at this repo we created to show how we did it with electron and clerk :) |
@mboudreau ... Can you help with setting these env variables mentioned in your repo : https://github.com/gameglass/clerk-electron-login/ This is what are are using, consider that
We are able to run the repo but authentication with google still does not work. Can you guide ? Please note that : This is error we receive :
Essentially, oauth_callback always fails. |
@UtsavChokshiCNU It's important to use the custom clerk provider with the custom clerk instance to inject The way we're doing it is nothing special. It is literally just taking what Clerk has done for Expo/React Native and porting it to electron. The code we based it on is this: https://github.com/clerk/javascript/blob/2659108ed55d558c656d184d4113873b28e86441/packages/expo/src/hooks/useOAuth.ts#L36 However, we did find another way of doing this is a much more centralized way. You could use a website (if you have one) to go through the oauth flow, and after the flow is done, take the userid and create a Sign In Token and then use that to deeplink back to your electron application (ex: Best of luck getting it working. Cheers. |
@mboudreau ... Sorry to bother you again. We were able to implement the following flow :
Login on the Desktop App (e.g., the Electron App) worked, but it is not able to refresh the token. So, I wanted to know how you have handled that. In particular, request to Here is the Sequence Diagram for your reference : sequenceDiagram
participant User
participant Desktop as Desktop App
participant WebApp as Web Frontend
participant Backend as Python Backend
participant Clerk as Clerk Auth
Desktop->>Desktop: 1. Register myapp:// protocol
User->>Desktop: 2. Launch desktop app
User->>Desktop: 3. Click "Continue with Google"
Desktop->>WebApp: 4. Open /desktop-auth
WebApp->>Clerk: 5. Check session status
Clerk->>WebApp: 6. No session found
WebApp->>Clerk: 7. Start Google OAuth flow
Clerk->>User: 8. Show Google sign-in popup
User->>Clerk: 9. Complete Google sign-in
Clerk->>WebApp: 10. OAuth Success
WebApp->>WebApp: 11. Redirect to /desktop-auth-session-generator
WebApp->>Backend: 12. Request sign-in token
Backend->>WebApp: 13. Return token
WebApp->>Desktop: 14. Redirect myapp://auth?signin-token=xyz
Desktop->>Desktop: 15. Create session with token
Note over Desktop,Clerk: Session Token Refresh Flow (Continuous)
loop Every 50 seconds
Desktop->>Clerk: Request new session token
Clerk->>Desktop: Return fresh token (60s validity)
end
Please note that our electron app's main process starts the express server (on localhost:3000) to render UI. All clerk request originates from that express server. Here are things we already tried (and failed):
Your guidance is much appreciated ! |
@UtsavChokshiCNU Hey mate, We actually didn't implement this flow for our desktop app yet, we're using the example at the github repo given for the time being as it's working and haven't tried this flow yet other than with our mobile app. That being said, you should look at our web request interceptors example for clerk APIs in this file. The thing about Clerk is that authentication is done one of 2 ways: with cookies based on origin headers (browser based) or using the And that should do it :) For any other support requests, please contact clerk directly - they're really responsive, especially on slack. |
Describe the bug
Description
I encountered an authorization error when attempting to sign into Badget.io using OAuth. The callback URL returned an "Unauthorized request" error, preventing login.
Steps to Reproduce
Expected Behavior
The OAuth process should complete successfully, and I should be logged into the system.
Actual Behavior
An error message is displayed stating "Unauthorized request," and I am unable to log in.
Error Messages
Additional Information
Screenshots
Steps to reproduce
Steps to Reproduce
Browsers
Chrome
Additional context (Is this in dev or production?)
production
The text was updated successfully, but these errors were encountered: