how to automatically generate access_token form OAuth for API? - oauth-2.0

I am using Spotify's API to fetch data and its using OAuth so I need to generate a new access_token every hour to use the API.... is there a way to generate access-token automatically ?

Related

Youtube Api LiveChatMessages: insert

I'm trying to create a bot that moderates youtube channels, but your api doesn't allow you to use the apiKey to use this api resource.
What alternatives do I have? Is there any other solution to use this api resource without doing an oauth2? or is there any way to do oauth2 from the api without going through a browser to get a valid token and use the api?
Thanks
I'm trying to create a bot that moderates youtube channels, but your api doesn't allow you to use the apiKey to use this api resource.
Api keys are only useable for public data not private user data
Is there any other solution to use this api resource without doing an oauth2?
You need to use Oauth2 and request authorization of the owner of the data.
is there any way to do oauth2 from the api without going through a browser to get a valid token and use the api?
No the user will always need to open the consent screen in a browser window. this will return to you the access token you need to access private user data.

generate an access token for a external API to use firebase functions

I am having trouble understanding how to accomplish this. I have Firebase functions running on my application. I am using an external API in which I can configure Webhooks to hit an endpoint on my Firebase functions to perform an action. To make sure that the call comes from this external API, they recommend using an oauth2 flow. Mainly they ask me for:
Provide us (the external API) with an ID and an access token;
these are used to access a URL which provides a bearer token;
this bearer token is then used to access the provided webhook URL until the bearer
token expires after a pre-determined period of time.
And there are 4 input fields:
1. OAuth2 access token url
2. OAuth2 client id
3. OAuth client secret
4. OAuth2 Scope. <---- NOT SURE WHAT THIS ONE MEANS
My question is how do I generate the access token and the client id for this external API?
What value should I put for the oAuth2 scope?
Thanks!
I was able to figure this out using auth0. In one of their documentations, they cleared explained what I was trying to accomplish. Posting here to future reference in case any one needs it.
Thanks all!
reference: https://auth0.com/docs/authorization/flows/client-credentials-flow#learn-more
You can generate the client ID and client secret in the Console > Credentials.
Cloud Functions API oAuth2 scope is https://www.googleapis.com/auth/cloud-platform.

Manually create a JWT token to be used by another API

I have an Asp.NET Web Api v2 setup where I use OAuth (v2) authentication and JSON Web Tokens (JWT). If a user wants access to an endpoint they need to provide the bearer token in the Authorization header. Users need to submit a username and password and if validated they are given an access token (JWT format) that they can then present in the Authorization header. As long as the JWT contains the role accepted by the endpoint all works well.
Now I would like an automated service (another API from another developer) to access one of my endpoints. How do I go about manually generating an access token that has a long expiration date and they can use to access my endpoint without having to submit a username/password. I would like to make it as simple as possible for the outside API to access my API so I just want to be able to hand them a JWT token that they can place in their code.

Koala Ruby Facebook: Refresh access token

I am using facebook koala gem in RoR. I just want to use it to search events and places. So I do not need any authentication for any user. I simply want to just use an access token to fire the search API. But the access token I'm using is from the Graph API explorer, so it expires after a certain period of time. I want to use an access token for life long and if not then wanted a way to refresh the expired access token in Koala Gem.

Issue with YouTube implementation using Google API

Hi iam trying to access YouTube data API by OAuth 2.0 authentication.I obtained access token and refresh token successfully.Now i am trying to upload video by using the following link .
https://developers.google.com/youtube/v3/code_samples/java#upload_a_video
I am unable to create credentials.pls suggest me the what is the userid i need to pass and from where i can get the userid to authorize method.
Credential credential = Auth.authorize(scopes, "uploadvideo");

Resources