MCPcopy Create free account
hub / github.com/apache/openwhisk-cli / getAccessToken

Function getAccessToken

commands/api.go:1012–1034  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1010}
1011
1012func getAccessToken() (string, error) {
1013 var token string = "DUMMY TOKEN"
1014 var err error
1015
1016 // If the api gw access token override has been set, use it instead of the default
1017 if len(ApiGwAccessToken) > 0 {
1018 token = ApiGwAccessToken
1019 whisk.Debug(whisk.DbgInfo, "API GW access token override used\n")
1020 } else {
1021 props, errprops := ReadProps(Properties.PropsFile)
1022 if errprops == nil {
1023 if len(props["APIGW_ACCESS_TOKEN"]) > 0 {
1024 token = props["APIGW_ACCESS_TOKEN"]
1025 }
1026 } else {
1027 whisk.Debug(whisk.DbgError, "readProps(%s) failed: %s\n", Properties.PropsFile, err)
1028 errStr := wski18n.T("Unable to obtain the API Gateway access token from the properties file: {{.err}}", map[string]interface{}{"err": err})
1029 err = whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
1030 }
1031 }
1032
1033 return token, err
1034}
1035
1036func getUserContextId() (string, error) {
1037 var guid string

Callers 1

api.goFile · 0.85

Calls 1

ReadPropsFunction · 0.85

Tested by

no test coverage detected