How to get oauth access token using puppeteer? - javascript

I need to first fetch the oauth access token and then pass it as a parameter to my post request,
please let me know how this can be achieved using puppeteer.
I am new to puppeteer and I am stuck kindly assist.

Was unable to find an appropirate way to resolve the issue with puppeteer, I resolved it using Axios

Related

Auth0 - Cannot get ID token from getAccessTokenSilently() response

using the auth0-react SDK
when I call getAccessTokenSilently()
I can see that it hits /oath/token and the response returns a new id_token as well as an access_token and some other things, however there doesn't seem to be any way to get the Id token from the response without modifying the library itself, or switching from the SDK to the API directly.
I wondered if perhaps under-the-hood it would store the id_token in a way that could be accessed with getIdTokenClaims but that doesn't seem to be the case either. anyone know how to get the id_token directly with the SDK? or if that's just not supported yet?

Cant retrieve Stripe checkout sessions (retrieve function not defined)

I'm trying to integrate the new Stripe checkout sessions into my website. On the NodeJS backend, I am trying to get the price from the created session, so I would try to use the checkout.sessions.retrieve function. When I invoke it like this:
session = await stripe.checkout.sessions.retrieve(cs_test_ABC*etc);
I get the following error:
TypeError: stripe.checkout.sessions.retrieve is not a function.
Can't really see where this error is coming from, as I am defining a stripe const at the beginning of my NodeJS file:
const stripe = require('stripe')('sk_test_AAAetc');
Has anyone encountered this before or knows possible steps to resolve this? Thank you so much!
That's the correct syntax to retrieve the session. I suspect that your version of stripe-node is not up to date. You need to be on at least version 6.28.0 to retrieve Checkout sessions.

How to use Chrome extension get Laravel passport token?

I'm working on using Chrome extension access Laravel passport API. Currently, the Laravel passport API is setup and working. I tried to use chrome.identity.launchWebAuthFlow to get passport token but not working. There is an example provided by Google, it is different from my use case.
I have two questions:
According to the Laravel document, the first step is request an authorization code, the API end point is /oauth/authorize. What the redirect_uri should be since it is a chrome extension but not a website?
After the user approve the request, I'm using chrome.identity.launchWebAuthFlow to get the access token from Passport. In laravel it is a POST request, the end point is /oauth/token. But I tried chrome.identity.launchWebAuthFlow, it is a GET request.
I can make this whole process working using PHP but not Chrome Extension. Any suggestions?
As per the launchWebAuthFlow docs:
When the provider redirects to a URL matching the pattern https://app-id.chromiumapp.org/*, the window will close, and the final redirect URL will be passed to the callback function.
As an example, you could use the following code:
let redirectUrl = chrome.identity.getRedirectURL('redirect');
chrome.identity.launchWebAuthFlow({
url: `https://my.app.domain.com/oauth/authorize?client_id=xxx&response_type=code&scope=&redirect_uri=${redirectUrl}`
}, (redirectUrl) => {
console.log(redirectUrl) // Redirect URL with oauth query params added
})

error when I try to fetch calendar events through google API, JS React

For some reason; I get error when trying to get my calendar events through google API. I code in JS and use React and have no idea why it does not work.
I have the token stored in sessionStorage and do get personal information about the user like name email and such stuff but I cannot proceed and get the calendar events. Please help!
I'm not sure what exactly you would like to see inside my App but let me know and I'll provide with the stuff because I do not want to upload the whole project lol
https://gyazo.com/37433e19f07e441adf368d1bbcad78e6
Maybe try to return res.send as you use async/await and it returns promise
I changed the structure of the app and I do now receive cal events when I hit one of my endpoints, but receiving other kind of error now, anyway this one can be closed.
Cross-origin request blocked, origin 'null' no access

Facebook auth api callback access token

I am accessing facebook's api via this url as I need to do manual login for the users:
https://www.facebook.com/dialog/oauth?client_id=123456&scope=publish_actions&redirect_uri=http://localhost:4004/auth/callback
I get the popup for authentication without a problem, give fb access and then my callback url is accessed with the url:
http://localhost:4004/?login#_=_
Normally I would expect an access token so I could post on the users behalf.
I'm writing my code in node and using the node npm fb package to help me post
Turns out you also need to tell facebook what you would like returned add this as one of the query parameters:
response_type=token
Then you'll get back the token in the url
complete url
https://www.facebook.com/dialog/oauth?client_id=123456&scope=publish_actions&redirect_uri=http://localhost:4004/auth/callback&response_type=token

Categories

Resources