I am trying to get via API call token for using it in Openshift so I can be authenticated/authorized and execute more API calls
a) As URL I used "https://oauth-openshift.apps.domain/oauth/authorize?response_type=code&client_id=openshift-browser-client
b) I used basic authentication user/password
c) the only header I used is X-CSRF-Token: xxx
I get response 200, but the token is not shown. It just says "Display Token", but cannot see it
I tried to change the response_type=token, client_id=openshift-challenging-client, but it doesn't work.
How can I get the token in postman to save it and use it in the next API calls (e.g. get pods, projects etc)?
When I use curl (response_type=token, client_id=openshift-challenging-client) from my jump server I get the token, but my target is to do that in postman
curl example that worked curl -v --insecure --user user:password --header "X-CSRF-Token: xxx" --url "https://oauth-openshift.apps.domain/oauth/authorize?response_type=token&client_id=openshift-challenging-client" 2>&1 | grep -oP "access_token=\K[^&]*"
From Postman:
Using resonse=token, client_id=openshift-challenging-client, the return is this. I get 200 with the below message, but test fails

The "display token" comes when I use response=code, client_id=openshift-browser-client. No error with the test, but I don't get the token again


Handling access token in Postman
Postman sets the value of the
access_tokenvariable in the Postman environment to the value stored in the Access Token variable.This sets the access_token as a Bearer Token, allowing it to be accessed using the placeholder {{access_token}}. This token can then be dynamically used in subsequent requests for authentication purposes.
Parsing
Access Tokenin PostmanInput : HTMLParsing
Setting/Getting via 'EnvironmentVariable'
log will display bottom/left side in Postmam
Mocking your Openshift server
Save as
server.jsInstall server dependencies
Run it
cURL testing
User ID : user User Password: 1234
The output will response HTML format as similar your response
Testing by Postman
#1 Get Token
Basic Auth
HeaderTestsResult
#2 Update Data call with access token
Select Type with
Bearer Tokenand Enter {{access_token}}It will use some names of Environment variables (my demo is 'dev') In Postman UI, right/top side.
Result of PUT call using access token
Pre-request Scriptjust loggingUpdate
Replace in
TeststabIf still not finding access token.
You need to find the correct regular expression string
Go this site
Step 1
Put REGULAR EXPRESSION
Put TEST STRING
Result
Right SideBoth displayStep 2
Put REGULAR EXPRESSION As same as Step 1
Put TEST STRING From your Postman's Body Output
If matches your token finding, use that regular expression
If still failed, copy your Body and update your question after TOKEN STRING - replace dummy string.