OAuth.02 Authentication give Error 400 : Invalid Request - oauth-2.0

I am trying to test the youtube live stream API that I have downloaded from Github to be able to use it in one of my projects
in the following the URL for the GitHub repository
https://github.com/youtube/api-samples
I have followed the steps to get OAuth Client ID and Secret and add them to my code but I keep getting the error

Related

bitbucket code search API getting 401 error

I am trying to use the bitbucket code search API and I am getting 401 error "Token is invalid or not supported for this endpoint."
I created a repository access token and can access this particular URL 'https://api.bitbucket.org/2.0/repositories/{username}' with an authorization bearer token in the header without any issue.
But I couldn't access the code search API with the same token. I am having an invalid token issue. My code search api -
https://api.bitbucket.org/2.0/teams/{username}/search/code?search_query=repo%3Asample%20source
username- sam
https://bitbucket.org/blog/bitbucket-code-search-api-now-available
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-other-operations/#api-teams-username-search-code-get
I am following the above two articles. In these articles it is mentioned like 'GET /2.0/teams/{username}/search/code'
what username I should give? I already tried with 'sam'
In the first article I am seeing the api you provided and what is "%7B6f461d1e-a3dd-433b-a0e3-7a69daf6ea47%7D" ?
https://api.bitbucket.org/2.0/teams/**%7B6f461d1e-a3dd-433b-a0e3-7a69daf6ea47%7D**/search/code?search_query=repo%3Aelasticsearch%20QueryBuilders
kindly provide more suggestions on this.
Note: This is a private repository and I am the only user in it.

Error TF401444 when calling TFS Server REST API with a PAT (personal access token)

I have created a PAT token for my user account in TFS Server 2017 (on-premises, not VSTS). Using Postman I am attempting to call the following REST API with Basic Auth:
GET http://{server:port}/tfs/DefaultCollection/_apis/projects?api-version=1.0
In response I get the following error:
TF401444: Please sign-in at least once as {Well Known SID for my user account} in a web browser to enable access to the service. - Microsoft Team Foundation Server
I have tried opening the same URL in Chrome and attempting to login with the PAT but with no success (the login is not completed). Any suggestions as to what I am missing here?
TFS seems to be recognising the PAT token as I receive a different error if I revoke it.
The issue here was the use of 'DefaultCollection' in the URI. I didn't have permissions on the default project collection in our TFS instance and needed to replace 'DefaultCollection' with the name of the collection I actually did have access to.
It seems obvious now, but the documentation didn't make it clear that this was a variable part of the URI so I had assumed the API was always hosted as part of the DefaultCollection.

Unable to get Authorization code for Devops using Postman oAuth2.0

I am trying integrate Devops with another 3rd part system, but i tried to access Devops from postman using oAuth2.0, but it is always failing, throwing me a error {"Error":"invalid_client","ErrorDescription":"Invalid client auth token."}
Does Devops support oAuth? if so what i am missing so i got this error?
The problem is that DevOps is using non standard headers for some reason. This causes the built in postman to not work. The way that I figured out to work around this is to input the Auth url directly into your browser. You can then extract the auth code from the callback URL.
Then with that code, make a post to the token endpoint in postman
https://app.vssps.visualstudio.com/oauth2/token
Use x-www-form-urlencoded body and fill out the following keys
"client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"
"client_assertion", your app secret
"grant_type", "urn:ietf:params:oauth:grant-type:jwt-bearer"
"assertion", your auth code from previous step
"redirect_uri", your callbackurl
Azure DevOps supports oAuth. If you follow the steps in the link below to get an oAuth token, and type the token directly in Postman, you'll get a successful response:
https://github.com/Microsoft/azure-devops-auth-samples/tree/master/OAuthWebSample

Youtube quota limit exceeded on a new Google Console Project

I am writing a PHP CLI script that will upload videos to my Youtube channel. I created a project in Google Console, enabled Youtube API, enabled OAuth and received my client ID and secret. Then I generated a refresh token using https://developers.google.com/oauthplayground .
The authentication seems to work as I don't get any errors regarding that, but I get the following error:
"code": 403,
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e."
The credentials are for a new project where I didn't use anything from the quota.
Why do I get this error and how could I fix it?
I think you're right #GeorgeOlah. I didn't want to waste time setting up OAuth2 stuff, so I generated a key with the playground and then tried to use it with https://github.com/h2non/youtube-video-api.
I immediately got quota errors using the access token from the playground.
So I setup a token using https://github.com/google/google-api-nodejs-client/blob/1bcb74430143e498b9fd58cf2ca2b97da2ed3b07/samples/oauth2.js.
So far, I've had no quota errors with that token.

Always getting "code_already_used" when exchanging code for access token w/Slack API

I'm writing a Slack app that adds Slash commands.
Every time I go through the OAuth flow, when I try to exchange a temporary auth code for an access token, I get the following JSON response:
{"ok"=>false, "error"=>"code_already_used"}
and despite that error message, the two slash commands provided by my app do get installed on the target Slack team.
The desired outcome is: I get a successful response from Slack's API, which contains the access_token and scopes for which the token is valid.
Troubleshooting I've tried so far:
Revoked permissions from my app & uninstalling from target team before trying again
Requesting additional scopes (e.g, commands,channels:history,users.profile:read which I don't need, instead of just commands) to see if that would cause the API to return an access token.
I am able to install on other teams outside of the original team I used when creating the app, but with the same api failure
Any suggestions for how to get the API to return an access token? Thanks in advance!

Resources