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

Add the option to get the client secret dynamically. #101

Merged
merged 5 commits into from
Sep 20, 2023

Conversation

alejandrodevs
Copy link
Contributor

@alejandrodevs alejandrodevs commented Sep 19, 2023

Add the possibility to get the client secret from a module in order to rotate the secret at least every 6 months (which is a good practice) without the need to be changing the config or env var and restart the application. Similar to the implementation of ueberauth_apple: https://github.com/ueberauth/ueberauth_apple/blob/main/guides/getting-started.md#generating-the-client-secret

Configuration would look like this:

config :ueberauth, Ueberauth.Strategy.Google.OAuth,
  client_id: System.get_env("GOOGLE_CLIENT_ID"),
  client_secret: {MyApp.Google, :client_secret}

and then:

defmodule MyApp.Google
  @spec client_secret(config :: keyword) :: String.t()
  def client_secret(_config \\ []) do
    # Get client secret from db, cache or any other custom implementation.
  end
end

This does not affect to the current implementation, it is backwards compatible.
What do you think? @yordis

@alejandrodevs alejandrodevs requested a review from a team as a code owner September 19, 2023 19:57
@yordis
Copy link
Member

yordis commented Sep 20, 2023

Do you mind adding a unit test for this? Thus far it makes sense

@alejandrodevs
Copy link
Contributor Author

@yordis Great! I added the unit tests.

@yordis
Copy link
Member

yordis commented Sep 20, 2023

Please forgive me for asking the following (it is on my document across all the repos 😭)

Do you mind adding an entry to the CHANGELOG.md and bumping the package version so it is easier to deploy?

@alejandrodevs
Copy link
Contributor Author

No worries, happy to contribute a little bit in the package.
Both things were done.

@yordis yordis merged commit fcfc954 into ueberauth:master Sep 20, 2023
2 checks passed
@yordis
Copy link
Member

yordis commented Sep 20, 2023

🚀 💜

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