Auth0 does not return user information immediately after creation - auth0

Auth0:
Sign up your user
Grep userId from response (I used jq)
Get user information by id immediately >> Returns nothing!
Repeat step 3 in 1 second >> OK
Check out this script
user=$(curl -s -X POST -d 'email=test1#mail.com&password=test1Pass&connection=Username-Password-Authentication' 'https://your-acc.auth0.com/dbconnections/signup')
userId=$(echo $user | jq -r '._id')
curl -X GET -H 'Authorization: Bearer insert-token' "https://your-acc.auth0.com/api/v2/users?q=user_id:\""$userId"\""
sleep 1
curl -X GET -H 'Authorization: Bearer insert-token' "https://your-acc.auth0.com/api/v2/users?q=user_id:\""$userId"\""

I was able to fix it by calling
/api/v2/users/{userId}
which returns single user. Surprisingly it works just fine.
Anyway, it does not solve my problem if I want to request multiple users at a time.
Did not get any response at auth0 forum.

Related

AWS Amplify Auth.verifyCurrentUserAttributeSubmit returns InternalErrorException

We have a Cognito user pool that supports login with email and phone number. Using Auth.verifyCurrentUserAttributeSubmit we are able to successfully verify code received on email for email change of logged in user. However the same verifyCurrentUserAttributeSubmit method returns InternalErrorException from Cognito when verifying phone_number attribute using the code received on sms. Wondering how to verify the phone_number change using Amplify?
Based on HTTP response from Cognito, something internally failed and seems to be a bug in Cognito but not sure if there is a work around. Interesting, it's able to verify email attribute.
From browser console, here is the curl equivalent snippet for the call made from Amplify in ReactJS app. The same API works fine if AttributeName being verified is email.
curl 'https://cognito-idp.ap-southeast-1.amazonaws.com/' \
-H 'authority: cognito-idp.ap-southeast-1.amazonaws.com' \
-H 'cache-control: max-age=0' \
-H 'content-type: application/x-amz-json-1.1' \
-H 'x-amz-target: AWSCognitoIdentityProviderService.VerifyUserAttribute' \
-H 'x-amz-user-agent: aws-amplify/5.0.4 js' \
--data-raw '{"AttributeName":"phone_number","Code":"713032","AccessToken":"xxxtokenxxxx"}' \
--compressed
Response:
{"__type":"InternalErrorException","message":"Internal server error."}

refreshing StubHub API tokens?

We are trying to refresh a previously working application's refresh tokens as per stub-hub's developers docs with the following commands (where <whatever> are account specific placeholders).
ENCRYPTED_ACCT=$(echo -n "<client-id>:<client-secret>" | base64);
curl -X POST "https://account.stubhub.com/oauth2/token" \
-u "${ENCRYPTED_ACCT}" --basic \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token" \
-d "refresh_token=<PREV_REFRESH_TOKEN>" \
--data-urlencode "scope=read:events";
In the past we've followed a similar flow (api changed since). But now with the recommended procedure the endpoint is failing due to invalid credentials for the ENCRYPTED_ACCT. Can anyone post a functioning workflow to refresh tokens of an existing account?

Add two separate messages with circuit rest api in the same subject box

I am trying to write two different messages to the same subject bot after each other. But any time a new subject with the same title is posted.
I use the rest api post call and tried this:
curl --insecure -X POST https://yourcircuit.com/rest/v2/webhooks/incoming/xxxx -d '{"text": "foobar1", "subject": "My fancy title"}'
curl --insecure -X POST https://yourcircuit.com/rest/v2/webhooks/incoming/xxxx -d '{"text": "foobar2", "subject": "My fancy title"}'
I assumed two messages under the same title box inside the circuit conversation.
What is shows:
What I want to achive:
Does anybody know how to achive this?
That is not supported with webhooks. This could be done with the regular REST API /conversations/{convId}/messages/{itemId}. See https://circuitsandbox.net/rest/v2/swagger/ui/index.html
You can try this using the swagger ui at https://circuitsandbox.net/rest/v2/swagger/ui/index.html
Here is the corresponding http request:
curl -X POST "https://circuitsandbox.net/rest/v2/conversations/05bd75f1-a8d5-40c0-b24a-28710ec1a57f/messages/cde0b57e-7f1d-4ffb-b2af-a1b7c7c9fa06" \
-H "accept: application/json" \
-H "authorization: Bearer ot-4f70c19edc6f43c4b89b4d39b4440000" \
-H "content-type: application/x-www-form-urlencoded" \
-d "content=hello"
Note that the token above has been invalidated. You need to use your own conversation ID, parent item ID and access token.
And here is how it looks in Circuit:

Can I get a working curl command to remove a system from RHEL subscription?

I want to automate the addition and removal of VMs from the RHEL Subscription. I want to use a curl command if possible and keep it simple.
I tried executing curl commands on the api.access.redhat.com/management/v1/subscriptions endpoints but it is giving errors like "Authentication parameters missing".
Below is an example command I am using:
curl -X GET -s -k -u username:Password "https://api.access.redhat.com/management/v1/subscriptions" -H "accept: application/json"
Expected to see the list of Subscribed systems but getting the "Authentication parameters missing" message.
In order to get all the subscriptions you have, run the following command:
curl -H "Authorization: Bearer $access_token" "https://api.access.redhat.com/management/v1/subscriptions"
You can retrieve the access_token variable by running the following command:
curl https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -d grant_type=refresh_token -d client_id=rhsm-api -d refresh_token=$offline_token
The offline_token, instead, has to be generated from the API Tokens Page.
Check this article for further details.

How can I obtain a Mule ARM registration token to be used to register a server into AMC

I was reading at
https://anypoint.mulesoft.com/apiplatform/anypoint-platform/#/portals/organizations/ae639f94-da46-42bc-9d51-180ec25cf994/apis/38784/versions/127446/pages/182856
because I want to automate Anypoint Runtime Manager enablement on lots of servers.
My plan is to use REST to get the proper registration token to be used to register a server into AMC. There are directions on the page:
To register a server you must first authenticate against the Anypoint Platform Authentication Manager and get an authentication token, with this token you need to obtain a registration token to be used to register a server into AMC.
I understand the first part and can get the authentication token, but I can't find a reference to how to get the registration token.
How can I get this token?
Thanks!
have you seen the Obtain the Server Registration Token part in the documentation?
take a look here, if you want to obtain a registration token by calling the REST API. There is a API endpoint called /servers/registrationToken
You can also get a registration token with the new anypoint-cli v2.x. This will combine several REST API calls for you. The command is:
runtime-mgr server token
You can type this in the interactive shell, or add this to the end of a stand-alone call from your favorite scripting environment. For example, if you have created a profile with your ANYPOINT_USERNAME, ANYPOINT_PASSWORD, and ANYPOINT_ORG, and ANYPOINT_ENV, you can then call:
anypoint-cli runtime-mgr server token
You can find the docs and installation instructions here: docs.mulesoft.com/runtime-manager/anypoint-platform-cli#runtime-mgr-server-token.
If you want to do this directly with the REST API, you'll have to make several calls:
POST a core services access_token from
anypoint.mulesoft.com/accounts/login
with the username and password in the BODY as a JSON object.
curl -X POST \
anypoint.mulesoft.com/accounts/login \
-H 'content-type: application/json' \
-d '{
"username":"yourUserName",
"password":"yourPassword"
}'
Store the response as a variable (let's call it {{access_token}}.
Copy this access_token in the header for every other API call: Key: Authorization, Value: bearer {{access_token}}
Obtain or store the organization ID in which you want to register the server. There's several ways to do this. The value is available via a GET request to
anypoint.mulesoft.com/accounts/api/me
curl -X GET \
anypoint.mulesoft.com/accounts/api/me \
-H 'authorization: bearer aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
You might want to use the JQ libraries to parse the organizationID from this JSON response.
Get the environment ID for the environment in which you want to register the Mule runtime (server) from a GET request to:
anypoint.mulesoft.com/accounts/api/organizations/{{organizationId}}/environments
curl -X GET \
https://anypoint.mulesoft.com/accounts/api/organizations/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb/environments \
-H 'authorization: bearer aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' \
-H 'content-type: application/json'
Make a GET request to
anypoint.mulesoft.com/hybrid/api/v1/servers/registrationToken
With the headers X-ANYPNT-ORG-ID and X-ANYPNT-ENV-ID set:
curl -X GET \
anypoint.mulesoft.com/hybrid/api/v1/servers/registrationToken \
-H 'authorization: bearer aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' \
-H 'x-anypnt-env-id: cccccccc-cccc-cccc-cccc-cccccccccccc' \
-H 'x-anypnt-org-id: bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb'
This will return a registration token.
Then use this registration token with the amc_setup -H command
amc_setup -H {{registration_token}} Server-Name