I've got authentication error with Alpaca broker api - python

Want some help from you.
I am working in Django/React project with Alpaca Broker APi https://alpaca.markets/broker
https://prnt.sc/1sfzv9k
I am trying to get relationship ID. Btw I am getting the error like screenshot
Please help me if you have an expertise with Alpaca API
Thanks

First, this error, basically means your API keys and Secret keys are incorrect. If that's the case, you need Regenerate new keys from Alpaca Broker Dashboard (please see screenshot)
Alpaca Broker API must authenticate using HTTP Basic authentication. Use your correspondent API key ID and secret as the username and password. The format is key_id:secret. Encode the string with base-64 encoding, and you can pass it as an authentication header.
Since you're testing with Postman, you can select the Basic Auth and enter the credentials accordingly as stated above.
You may also check here in the Alpaca Broker API docs

Related

Azure key vault - Authorization header

I'm trying to use the API below to get access to a key vault.
https://learn.microsoft.com/en-us/rest/api/keyvault/keyvault/vaults/get
When I try to run this API in Alteryx, it asks for a authorization header.
I'm not sure what information I need to provide in this authorization header in order to get access to the specific key vault.
Can someone please share some knowledge on this?
enter image description here
Thanks
Azure Key Vault describes its request authentication in the Authentication section of this Authentication, requests and responses documentation:
Access tokens must be sent to the service using the HTTP Authorization header:
PUT /keys/MYKEY?api-version=<api_version> HTTP/1.1
Authorization: Bearer <access_token>
The access token is a token string that can be obtained via OAuth2 authentication. An easy way to obtain access tokens for Azure resources in Python is with the azure-identity library, which can be used with the azure-mgmt-keyvault library to make the request you're describing here.
If you'd like to use plain REST requests instead, access tokens are described thoroughly in this Microsoft identity platform access tokens documentation.
Disclaimer: I work with the Azure SDK for Python.

What is Token Based Authentication, How to access REST API GET request using it? NETSUITE API

I cannot figure out that how can I get a GET request and authorize them using token-based authorization where I have only consumer and token keys with their secrets.
Search for token based authentication for restlets.
e.g.
Looking for example Python code for Netsuite API using OAuth?
The concept remains the same - you need to add the authentication data to the header when you make the GET request.

How to automate oAuth2.0 authorization in Python?

I'm using oAuth2.0 Authorization with grant type as 'Client Credentials' in Postman to get the new access token. Once the token is generated, I hit the API URL in the POST method and get JSON response for a payload.
I have below details -
a. Access Token URL
b. API URL
c. Client ID
d. Client Secret code
I want to automate this process in Python.
The research I did so far asks for authorize_url/redirect_uri/base_url however I don't have these details (unless there is a gap in my understanding)
Could someone please help me here.
Thanks in advance!

OAuth 2 and the Slack APIs for posting images

First Question: So, I'm attempting to post an image to a specific slack channel using the files.upload API call in the Slack APIs. I have a client_id and a client_secret. I just want this to be used for my team using slack to communicate. Is this possible without getting an access token through OAuth 2?
Secondary question: In my attempt to go through OAuth 2, I have placed my client_id into a python dictionary and then json.dumps() it. I stored the id in the field 'client_id' yet the message returned is "OAuth message: please specify a 'client_id'" Why is this an error? Should I name it something other than 'client_id'?
EDIT: I found the answer to question 2. I don't receive what I expected, but simply sending the dictionary without turning into a JSON object solved the client_id issue.
You always need an access token to upload a file with the Slack API.
But you can install your Slack app to your own Slack workspace without going through the OAuth process yourself. Just create your Slack app and go to the "Install App" page your app. Which you find under Manage your apps.
Example screenshot:
Another option (although not recommended) is to us a legacy token. You can create it here:
https://api.slack.com/custom-integrations/legacy-tokens

Attempting to use Microsoft Graph API without POST for bearer token

I currently am using the Microsoft Office 365 API to get information about Mailbox Usage and Activity. I am attempting to switch over to the Graph API, and am having some trouble.
When I use the current API, I give an 'auth' field in my header so I avoid posting for a bearer token before sending a GET request.
When I attempt the same in the Graph API I get the following error: "CompactToken parsing failed with error code: -2147184105"
After doing some research, I'm unsure if it is even possible to access the Graph API without posting for a bearer token. I would like to access it by still using the authorization credentials in a 'auth' field. Please let me know of any input/help you can provide!
If I follow correctly, you're looking to obtain a bearer token without going through a separate "POST" to convert the authorization code into an access (bearer) token? This is supported by the v2 Endpoint (and Microsoft Graph) using the Implicit Grant.
I wrote an article on this a while back that might be helpful getting you started - v2 Endpoint and Implicit Grant

Categories