GCP-无法打印身份令牌

时间:2019-07-23 14:23:36

标签: google-cloud-platform gcloud google-cloud-sdk google-cloud-iam

我正在尝试为我的个人帐户获取JWT,但是此命令出错了:

$ gcloud auth print-identity-token
ERROR: (gcloud.auth.print-identity-token) `--audiences` can only be specified for service account.

有人抱怨我无法提供--audiences选项,但我没有提供。根据{{​​3}}的说法,我应该能够在登录个人开发人员帐户时使用此命令。

编辑:我正在使用Google Cloud SDK 254.0.0

更新:现在Google刚刚发布了gcloud 255.0.0版本,该命令的工作方式与单个帐户的广告完全相同。

1 个答案:

答案 0 :(得分:1)

您收到的错误是正确的。不支持尝试使用#]===========================================================================[# #] WORKER [#================================================================[# #]===========================================================================[# class InstallWorker(QObject): """ Worker informing about start and finish of the create process. """ started = pyqtSignal() finished = pyqtSignal() @pyqtSlot(tuple) def install(self, args): self.started.emit() name, location, with_pip, site_packages, symlinks = args # outputs as excpected #print(args) #print("pip:", args[2], "\nsite-pkgs:", args[3], "\nsymlinks:", args[4]) venv.create( os.path.join(location, name), # 'location' and 'name' works with_pip=with_pip, # installs pip always (the default) system_site_packages=site_packages, # not tested yet symlinks=symlinks, # never symlinking ) self.finished.emit() 来为“ gmail”类型的帐户修改Google OAuth用户凭据。受众群体class InstallPackages(QWizardPage): """ Install packages via `pip` into the created virtual environment. """ def __init__(self): super().__init__() self.setTitle("Install Packages") self.setSubTitle("Specify the packages which you want Pip to " "install into the virtual environment.") self.progressBar = ProgBarWidget() #]===================================================================[# #] THREAD [#========================================================[# #]===================================================================[# thread = QThread(self) thread.start() self.m_install_worker = InstallWorker() self.m_install_worker.moveToThread(thread) self.m_install_worker.started.connect(self.progressBar.exec_) self.m_install_worker.finished.connect(self.progressBar.close) self.m_install_worker.finished.connect(self.reEnablePage) #]===================================================================[# #] PAGE CONTENT [#===================================================[# #]===================================================================[# # just some test content (page is still in development) TestLabel = QLabel("This is a test label:", self) TestLineEdit = QLineEdit(self) TestLabel.setBuddy(TestLineEdit) TestLabel2 = QLabel("This is a test label:", self) TestLineEdit2 = QLineEdit(self) TestLabel2.setBuddy(TestLineEdit2) v_layout = QVBoxLayout(self) v_layout.addWidget(TestLabel) v_layout.addWidget(TestLineEdit) v_layout.addWidget(TestLabel2) v_layout.addWidget(TestLineEdit2) self.setLayout(v_layout) def initializePage(self): #interprVers = self.field("interprVers") self.interprPath = self.field("interprPath") self.venvName = self.field("venvName") self.venvLocation = self.field("venvLocation") self.withPip = self.field("withPip") self.sitePackages = self.field("sitePackages") #launchVenv = self.field("launchVenv") self.symlinks = self.field("symlinks") # set the selected interpreter sys.executable = self.interprPath # run the create process self.createProcess() # disable the page as long as the progress bar is up self.setEnabled(False) def reEnablePage(self): """ Re-enable page after the create process has finished. """ self.setEnabled(True) def createProcess(self): """ Create the virtual environment. """ args = ( self.venvName, self.venvLocation, self.withPip, self.sitePackages, self.symlinks, ) wrapper = partial(self.m_install_worker.install, args) QTimer.singleShot(0, wrapper) class Summary(QWizardPage): def __init__(self): super().__init__() self.setTitle("Summary") self.setSubTitle("...............") if __name__ == "__main__": import sys app = QApplication(sys.argv) wizard = VenvWizard() wizard.show() sys.exit(app.exec_()) 是创建JWT时指定的声明。

如果您使用的是Identity Platform,则可以在一定程度上进行。

您不能使用声明修改用户凭据,但是可以在请求服务帐户身份令牌时指定某些声明。

执行以下命令claims。如果活动帐户是电子邮件地址,而不是服务帐户电子邮件地址,则会收到此错误。