Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

howto get project token #50

Open
cforce opened this issue Nov 6, 2024 · 4 comments
Open

howto get project token #50

cforce opened this issue Nov 6, 2024 · 4 comments

Comments

@cforce
Copy link

cforce commented Nov 6, 2024

Disclosure Portal Only project owners in the Disclosure Portal have the permissions to do these steps. a) Create a new Project in the >Disclosure Portal. Take note of the Unique identifier of the project, you will need it in a moment. b) Create a token. You will need this >token to access your project with the Disclosure-CLI.

How to create such token to authenticate?
Is is a Tokenmaster token or is it gas/iamat or embeedded somewhwre is DISCO (where?)

@cforce
Copy link
Author

cforce commented Nov 6, 2024

found the token, but still does not work to use the token in in a curl


#!/bin/bash

# Environment variable setup
#export DISCO_PROJECT_TOKEN=

# API URL
API_URL="https://production.gorillas.mercedes-benz.com/disco/v1/policyrules/XXXXXXXXXXXXXXXXXXXXXXXXXXX"


# Output file
OUTPUT_FILE="policy_rules_output.json"

# Curl command to get data from the API using OAuth token
curl "$API_URL" \
  -H "accept: application/json, text/plain, */*" \
  -H "Authorization: Bearer $DISCO_PROJECT_TOKEN" \
  -o "$OUTPUT_FILE"

# Check if the request was successful
if [ $? -eq 0 ]; then
  echo "Data successfully written to $OUTPUT_FILE"
else
  echo "Failed to retrieve data"
fi

@karlpip
Copy link
Collaborator

karlpip commented Nov 6, 2024

Try prepending DISCO to the token.

@cforce
Copy link
Author

cforce commented Nov 6, 2024

Still 404

#!/bin/bash

# Environment variable setup
#export DISCO_PROJECT_TOKEN=

# API URL
API_URL="https://production.gorillas.mercedes-benz.com/disco/v1/policyrules/XXXXXXXXXXXXXXXXXXXXXXXXXXX"


# Output file
OUTPUT_FILE="policy_rules_output.json"

# Curl command to get data from the API using OAuth token
curl "$API_URL" \
  -H "accept: application/json, text/plain, */*" \
  -H "Authorization: Bearer DISCO ${DISCO_PROJECT_TOKEN}" \
  -o "$OUTPUT_FILE"

# Check if the request was successful
if [ $? -eq 0 ]; then
  echo "Data successfully written to $OUTPUT_FILE"
else
  echo "Failed to retrieve data"
fi

@karlpip
Copy link
Collaborator

karlpip commented Nov 7, 2024

There is a space missing between the token value and DISCO string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants