Skip to content
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

docs: OidcClientAuthentication.clientSecretPost only choice for Flutter Web - Security Question #34

Closed
redsk opened this issue Oct 31, 2023 · 9 comments
Labels
documentation Improvements or additions to documentation

Comments

@redsk
Copy link

redsk commented Oct 31, 2023

Description

In packages/oidc/example/lib/app_state.dart two OidcUserManager's are created,

  • one with clientCredentials: const OidcClientAuthentication.none
  • one with clientCredentials: const OidcClientAuthentication.clientSecretPost

Now for a Flutter web app that wants to authenticate using Google Sign In, only the one with clientSecretPost seems to work. When creating a OAuth client ID only the web based one can be applied as it's the only one supporting custom redirects.

Now, isn't it a security issue to store the clientSecret in the Flutter Web app @ahmednfwela ?

@redsk redsk added the documentation Improvements or additions to documentation label Oct 31, 2023
@ahmednfwela
Copy link
Member

@redsk
no it isn't a security risk since google doesn't consider the client_secret really a "secret" for web, you can think of it as part of the client_id.

another alternative is to use implicit auth.

@ahmednfwela
Copy link
Member

ahmednfwela commented Oct 31, 2023

also refer to google's own documentation:
https://developers.google.com/identity/protocols/oauth2/javascript-implicit-flow

image

@redsk
Copy link
Author

redsk commented Oct 31, 2023 via email

@ahmednfwela
Copy link
Member

ahmednfwela commented Oct 31, 2023

@redsk
well there has been a hot debate (authts/oidc-client-ts#152) over this, and some people think sharing client_secret is still safer than implicit flow, but I disagree with both.

the actual "best" practice, would be using your own IdP server that supports PKCE which you login with, and support google auth server side instead of client side.

EDIT: I also state this in the docs: https://bdaya-dev.github.io/oidc/oidc-usage/#loginimplicitflow
image

@redsk
Copy link
Author

redsk commented Oct 31, 2023

@ahmednfwela yeah both solutions are actually bad and the real solution is what you described.

Apparently there's a plugin for spring boot which is what I use as backend.

Hopefully it's not too messy to deal with the redirects... :)

@ahmednfwela
Copy link
Member

@redsk Do you still need more clarification in the docs or can this issue be closed ?

@ahmednfwela
Copy link
Member

Closing this for inactivity

@ghost
Copy link

ghost commented Oct 9, 2024

@redsk no it isn't a security risk since google doesn't consider the client_secret really a "secret" for web, you can think of it as part of the client_id.

another alternative is to use implicit auth.

Not sure what google recommends, but if i am using your library for Microsoft Entra login, i wont be comfortable storing clientSecret in the code.

@ahmednfwela
Copy link
Member

@redsk no it isn't a security risk since google doesn't consider the client_secret really a "secret" for web, you can think of it as part of the client_id.

another alternative is to use implicit auth.

Not sure what google recommends, but if i am using your library for Microsoft Entra login, i wont be comfortable storing clientSecret in the code.

since entra supports auth code with PKCE it would be better to use that instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants