(*, config_file, profile, oob, skip_valid, output)
| 1021 | skip_valid=skip_valid, output=output) |
| 1022 | |
| 1023 | def _login(*, config_file, profile, oob, skip_valid, output): |
| 1024 | config = validate_config_v1(load_config(config_file=config_file, profile=profile)) |
| 1025 | |
| 1026 | with LeapAuthFlow.from_config_model(config) as flow: |
| 1027 | if skip_valid: |
| 1028 | if flow.ensure_active_token(): |
| 1029 | output('Valid token found, skipping authorization.') |
| 1030 | return |
| 1031 | |
| 1032 | if oob: |
| 1033 | flow.run_oob_flow(open_browser=True) |
| 1034 | else: |
| 1035 | flow.run_redirect_flow(open_browser=True) |
| 1036 | |
| 1037 | output('Authorization completed successfully. ' |
| 1038 | 'You can now use "dwave auth get" to fetch your token.') |
| 1039 | |
| 1040 | |
| 1041 | @auth.command() |
no test coverage detected