Youtrack REST API "Failed to create service account from Hub, giving up" error - youtrack

I'm trying to receive data from REST Api after Authorization in Hub. Here is my actions:
1.Authenticate application in Hub using Client credentials flow (by the way, is it right flow choice for chat bot?)
POST /api/rest/oauth2/token HTTP/1.1
Host: hub.example.com
Authorization: Basic base64(service_id + “:” + service_secret)
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&scope=YOUTRACK_SERVICE_ID
2.Then i'm trying to get issues from YouTrack, using recieved access token
GET /rest/issue HTTP/1.1
Host: yt.example.com
Authorization: Bearer ACCESS_TOKEN
Accept: application/json
Response has status 500 with this message
{"value": "Failed to create service account from Hub, giving up"}
Both Hub and YouTrack is stand-alone.
What's going on and what should i do? Thanks

Updating YouTrack to fresh build fixes issue.
Thanks to Jk1's comment above.

Related

Authorizing API Requests to 3rd Party Services in Mongodb Realm

I'm building a React app that allows users to login with Google and then connects to a webhook/3rd Party service in Realm. The service should only return data that the users own.
I've set up the OAuth 2 with Google and can get back access_token for a user and I then pass it in the header (I've also tried the URL params) to the webhook. But I get an error back saying:
400 "no authentication methods were specified" - "Invalid Parameter".
After much testing, I've identified that it must be a Realm issue - but I can't figure out what.
I've tried authenticating with Google in Postman and sending a request from there like this:
GET <incoming_webhook URL>
Request Headers
Authorization: Bearer <access_token>
User-Agent: PostmanRuntime/7.26.10
Accept: */*
Host: us-east-1.aws.webhooks.mongodb-realm.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
But I get the same error.
In Realm I have "Google" enabled as an authentication providers (and the authentication works just not the authorization through the webhook).
Per https://docs.mongodb.com/realm/services/configure/service-webhooks/#configure-user-authentication, you can choose email/password, an API key, or a custom JWT token. I don't know whether you can use google login directly to a webhook, but you're probably better off making a realm function instead.
Regarding the error no authentication methods were specified, you can specify the type of authentication method (using a custom JWT as an example) by either:
putting it in the header:
Header: jwtTokenString, Value: eyJhbGci.....
OR
by including it as part of the webhook body:
{
"jwtTokenString":"eyJhbGci...",
"mydata": "my data value"
}
If you try to use both methods, you get a multiple authentication methods used error. HTTP Bearer tokens in the header, etc, are useless here.
For an API Key, instead of jwtTokenString, use api-key; or email`password` for email\password authentication.
I found these methods of providing authenticating information really unintuitive and the documentation very unclear.

Keycload Admin Api - logout-all endpoint not working

When calling the /{realm}/logout-all endpoint, the request always results in a "500 - Internal Server Error" and "error": "unknown_error" in the body. All other endpoints work as they should.
I made sure to call the endpoint with a new token and the Authorization-key in the header of the request. All calls are made from postman for testing.
Did I miss something?
Edit 1:
Keycloak Version: 12.0.2
The call: (generated the token with the admin-cli client and the admin user, so pribvileges shoudln't be a problem (?))
The log:
For future reference and anyone who has the same problem with Keycloak:
In some of the requests (e.g. logout-all) you have to provide a Accept: application/json header, otherwise Keycloak defaults back to application/octet-stream, for which Keycloak is missing the necessary classes.

Freeagent authentication with accesstoken

I go through with https://dev.freeagent.com/docs/oauth for implement the API.
But not able to get the access-token. I got the code but the process to get access-token I face below issue.
Request:
POST /v2/token_endpoint HTTP/1.1
Host: api.sandbox.freeagent.com
grant_type: authorization_code
code: 4/z7IBgRS-Pjx6y5-djE-uaRAjqeYleIdVCyjwiFgnfdg
redirect_uri: https://google.com
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
client_id: 3go0PEltpEHFFzEOdliIzQ
client_secret: OLefVbuT3LhEqpMh-2iq3w
Cache-Control: no-cache
Postman-Token: d47f46b7-9e1d-2969-8a40-53ee2120d5c2
Response:
{
"error": "invalid_request"
}
FreeAgent Quick Start Guide
It's very condensed and not entirely clear but I followed along with the FreeAgent Quick Start Guide and eventually was able to get the Access Token as well as the Refresh Token.
Using the Google OAuth 2.0 Playground I was able to authenticate myself and receive the various responses.
It's all in their guide.
Good luck!

Google Oauth 2.0 scope issue

I want to access the Google Drive using the OAuth 2.0 for Devices to upload files. So I set the scope variable as https://www.googleapis.com/auth/drive and I have enabled the apis on google developer console.
My Request
POST /o/oauth2/device/code HTTP/1.1
Host: accounts.google.com
Content-Type: application/x-www-form-urlencoded
client_id=3146639059-qvroaqrtit609qaknv8anvdn2umus01q.apps.googleusercontent.com & scope=https://www.googleapis.com/auth/drive
But what I am getting in response is
{
"error" : "invalid_scope",
"error_description" : "Not authorized to request the scopes: [https://www.googleapis.com/auth/drive]",
"error_uri" : "http://code.google.com/apis/accounts/docs/OAuth2.html"
}
Instead of https://www.googleapis.com/auth/drive if I use email
as scope its working fine.Please help me to resolve this issue.
Thanks
You have to post the email address that you get from developer console not the client Id, and you have to authorize the client id on your domaine (Cpanel) for the drive scope.

Parse tweets Twitter API

I am trying to get the latest tweets from a twitter user. This is what I've got so far:
$string = file_get_contents("https://api.twitter.com/1/statuses/show.json?id=Cristiano&include_entities=true");
$json_=json_decode($string,true);
This is my error message:
{"errors":[{"message":"Bad Authentication data","code":215}]}
What is the problem?
You'll want/need to migrate to the latest version of the API: 1.1. More information about the deprecation of version 1 can be found at the Twitter API Calendar of Changes documentation.
Next, you'll need to authenticate to the API prior before having access to it. More information about that can be found at the Twitter API Authentication & Authorization page.
POST /oauth2/token HTTP/1.1
Host: api.twitter.com
User-Agent: My Twitter App v1.0.23
Authorization: Basic eHZ6MWV2RlM0d0VFUFRHRUZQSEJvZzpMOHFxOVBaeVJn
NmllS0dFS2hab2xHQzB2SldMdzhpRUo4OERSZHlPZw==
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 29
Accept-Encoding: gzip
grant_type=client_credentials
That is the required HTTP POST request. How do I sent it using PHP?