简体   繁体   中英

How do I generate authentication tokens within Foundry Code Workbook to use as an argument to APIs?

In a Foundry Code Workbook, I'm trying to make a call to an API where one of the arguments is an authentication token.

What is the best way to generate authentication tokens during execution? Can they be reused in multiple calls?

You can use the command below to get a token during the execute stage:

token = spark.sparkContext.getLocalProperty('foundry.spark.session.bearerToken')

The token should be available for more than one call. If you need different/new tokens you can call the Multipass API to generate a new one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM