Skip to content

Commit

Permalink
Fix flask app example (#445)
Browse files Browse the repository at this point in the history
## Changes
There have been some changes with the OAuth APIs since this example was
written. I've cleaned this up a bit so that it works with the current
SDK.

## Tests
<!-- 
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->

- [ ] `make test` run locally
- [ ] `make fmt` applied
- [ ] relevant integration tests applied
  • Loading branch information
mgyucht authored Nov 17, 2023
1 parent 5fc77b0 commit a16a204
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions examples/flask_app_with_oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,9 @@ def register_custom_app(oauth_client: OAuthClient, args: argparse.Namespace) ->
password=getpass.getpass("Password: "),
)

logging.info("Enrolling all published apps...")
account_client.o_auth_enrollment.create(enable_all_published_apps=True)

status = account_client.o_auth_enrollment.get()
logging.info(f"Enrolled all published apps: {status}")

custom_app = account_client.custom_app_integration.create(
name=APP_NAME, redirect_urls=[f"http://localhost:{args.port}/callback"], confidential=True,
scopes=["all-apis"],
)
logging.info(f"Created new custom app: "
f"--client_id {custom_app.client_id} "
Expand All @@ -131,7 +126,7 @@ def init_oauth_config(args) -> OAuthClient:
client_id=args.client_id,
client_secret=args.client_secret,
redirect_url=f"http://localhost:{args.port}/callback",
scopes=["clusters"],
scopes=["all-apis"],
)
if not oauth_client.client_id:
client_id, client_secret = register_custom_app(oauth_client, args)
Expand Down

0 comments on commit a16a204

Please sign in to comment.