-
Notifications
You must be signed in to change notification settings - Fork 16
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
Auth0 integration via CLI #205
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ Your password isn't visible after deployment so write it down! | |
|
||
```{important} | ||
The Auth0 integration is only available for customers in the Teams plan. If you're | ||
insterested in learning more, contact us at [[email protected]](mailto:[email protected]) | ||
interested in learning more, contact us at [[email protected]](mailto:[email protected]) | ||
``` | ||
|
||
The password protection feature allows a single set of credentials | ||
|
@@ -35,4 +35,69 @@ an integration with [Auth0](https://auth0.com/). The authentication layer is | |
transparent to your application (there is no need to modify your code), and you | ||
only need to supply your Auth0 configuration parameters. | ||
|
||
### Using the CLI | ||
|
||
To configure Auth0 via the CLI, navigate to the folder where your project files are and make sure you've set your [API key.](../quickstart/apikey.md) Now run: | ||
|
||
```sh | ||
ploomber-cloud templates auth0 | ||
``` | ||
|
||
The Auth0 template requires your project to be initialized. If it hasn't been initialized yet, you can initialize it on the spot. You should see something like this: | ||
|
||
```sh | ||
Project must be initialized to continue. Would you like to initialize? [y/N]: y | ||
Initializing new project... | ||
Inferred project type: 'your-project-type' | ||
Is this correct? [y/N]: y | ||
Your app 'project-name-1999' has been configured successfully! | ||
To configure resources for this project, run 'ploomber-cloud resources' or to deploy with default configurations, run 'ploomber-cloud deploy' | ||
``` | ||
|
||
If your project has already been initialized, you won't see this. You'll then be prompted to enter three credentials from Auth0: | ||
|
||
1. `AUTH_SECRET` | ||
2. `AUTH_CLIENT_ID` | ||
3. `AUTH_ISSUER_BASE_URL` | ||
|
||
These can be obtained from your Auth0 application page. If you haven't yet created an application, log into Auth0 and create one. Then find the credentials here: | ||
|
||
![](../static/password/auth0-credentials.png) | ||
|
||
Once you've entered your credentials, you should see a confirmation like this: | ||
|
||
```sh | ||
Successfully configured auth0. To deploy, run 'ploomber-cloud deploy' | ||
``` | ||
|
||
```{note} | ||
If you already created an `.env` file, these credentials have been be saved there (along with your other secrets). If you haven't, one has been be created for you with the credentials saved. | ||
``` | ||
|
||
Now, run `ploomber-cloud deploy` to deploy your project. | ||
|
||
### Set /callback and /status URLs | ||
|
||
Almost done! We just need to set the `callback` and `logout` URLs for your Auth0 app. Navigate to your Ploomber project's application page and copy the application URL. It should look like `https://application-name-1999.ploomberapp.io`. | ||
|
||
Now, go back to the Auth0 application page and scroll down to `Application URIs`. Set these values: | ||
|
||
- Allowed Callback URLs: `https://application-name-1999.ploomberapp.io/callback` | ||
- Allows Logout URLs: `https://application-name-1999.ploomberapp.io/status` | ||
|
||
It should look like this: | ||
|
||
![](../static/password/auth0-urls.png) | ||
|
||
```{tip} | ||
If you ever re-initialize and deploy your app under a different name, you'll have to update these URLs. | ||
``` | ||
|
||
You're all set! Once your application has finished deploying, click `View Application`. You should be met with Auth0 authentication: | ||
|
||
![](../static/password/auth0-login.png) | ||
|
||
Simply login and you'll be re-directed to your application. | ||
|
||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the client secret is not
AUTH_SECRET
. I had the same doubt when working on this but based on the docs, it seems likeAUTH_SECRET
can be any string. I think we can even generate it ourselves:can you do some research on this?