Posts tagged with oauth

I'm developing a POC for a MuleSoft API (still running locally) that would fetch leads from a form. I have created a page and form and submitted a test lead via the Leads Ad Testing Tool. I can see the test lead in the Lead Centre.

I have also created the app with Product (Facebook Login for Business), I'm not sure if this is the same as "Facebook Login" I'm seeing in other post but there are no other option for a Facebook Login.

Below are the settings in the Basic > Settings and Client OAuth settings in the Facebook Login for Business > Settings menu.

[Basic > Settings] (https://i.sstatic.net/JBs5NK2C.png) Client OAuth settings

Below is the XML Code with Request Config:

<?xml version="1.0" encoding="UTF-8"?> <mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:oauth="http://www.mulesoft.org/schema/mule/oauth"     xmlns:http="http://www.mulesoft.org/schema/mule/http"     xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/oauth http://www.mulesoft.org/schema/mule/oauth/current/mule-oauth.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">     <http:request-config name="HTTP_Request_configuration_client_credentials" doc:name="HTTP Request configuration" doc:id="b4a82eca-5bb9-4333-a8ea-7599b9307a51" >         <http:request-connection protocol="HTTPS" host="graph.facebook.com">             <http:authentication >                 <oauth:client-credentials-grant-type clientId="xxxx" clientSecret="xxxx" scopes="public_profile,email,pages_show_list,pages_read_engagement,pages_manage_metadata,leads_retrieval" tokenUrl="https://graph.facebook.com/v20.0/oauth/access_token" />             </http:authentication>         </http:request-connection>     </http:request-config>     <http:request-config name="HTTP_Request_configuration1" doc:name="HTTP Request configuration" doc:id="826fbda6-7cf0-49b6-a153-6467b9f190c3" >         <http:request-connection protocol="HTTPS" host="graph.facebook.com" >             <http:authentication >                 <oauth:authorization-code-grant-type externalCallbackUrl="http://localhost:8081/oauth2callback" localAuthorizationUrl="http://localhost:8081/oauth/authorize" authorizationUrl="https://graph.facebook.com/oauth/authorize" clientId="xxxx" clientSecret="xxxx" scopes="public_profile,email,pages_show_list,pages_read_engagement,pages_manage_metadata,leads_retrieval" tokenUrl="https://graph.facebook.com/v20.0/oauth/access_token" localCallbackConfig="asg-facebook-poc-api-httpListenerConfig" localCallbackConfigPath="/oauth2callback"/>             </http:authentication>         </http:request-connection>     </http:request-config>          <sub-flow name="fetch-leads-subflow" doc:id="b497fa90-1bcb-4321-a419-8311eb69fdbd" >         <http:request method="GET" doc:name="Request" doc:id="c84c143f-1dc1-47f3-868a-8dc7d7685d98" config-ref="HTTP_Request_configuration1" path="/v20.0/me"/>         <ee:transform doc:name="Transform Message" doc:id="6419b680-f8fd-44db-9305-00cea610913b" >             <ee:message >                 <ee:set-payload ><![CDATA[%dw 2.0 output application/json --- payload]]></ee:set-payload>             </ee:message>         </ee:transform>         <logger level="INFO" doc:name="Logger" doc:id="b8e4609e-12a2-4f2b-9600-f6fee13736a8" message="#[payload]"/>     </sub-flow> </mule> 

Error I receive, when I tried accessing the simple endpoint in Facebook /me: ERROR

ERROR 2024-09-25 20:48:13,112 [[MuleRuntime].uber.07: [asg-facebook-poc-api].get:\fetch-leads:asg-facebook-poc-api-config.CPU_LITE @5d699551] [processor: fetch-leads-subflow/processors/0; event: 69e982e0-7b3c-11ef-8d30-9009df41381d] org.mule.runtime.core.privileged.exception.DefaultExceptionListener:  ******************************************************************************** Message               : No access token found. Verify that you have authenticated before trying to execute an operation to the API. Element               : fetch-leads-subflow/processors/0 @ asg-facebook-poc-api:scheduler-fetch-leads.xml:85 (Request) Element DSL           : <http:request method="GET" doc:name="Request" doc:id="c84c143f-1dc1-47f3-868a-8dc7d7685d98" config-ref="HTTP_Request_configuration1" path="/v20.0/me"></http:request> Error type            : HTTP:SECURITY FlowStack             : at fetch-leads-subflow(fetch-leads-subflow/processors/0 @ asg-facebook-poc-api:scheduler-fetch-leads.xml:85 (Request)) at get:\fetch-leads:asg-facebook-poc-api-config(get:\fetch-leads:asg-facebook-poc-api-config/processors/1 @ asg-facebook-poc-api:asg-facebook-poc-api.xml:202 (fetch-leads-subflow)) at asg-facebook-poc-api-main(asg-facebook-poc-api-main/processors/0 @ asg-facebook-poc-api:asg-facebook-poc-api.xml:13)   (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ******************************************************************************** 


I also tried in Postman using http://localhost:8081/oauth/authorize, logged in and it worked.

I tried the other option client credentials grant type but it requires the access token which I don't have in the first place. Did not work on this.

I am trying to create an application where the application requires access to the Facebook posts(along with post title, posted date, author, all comments and replies). I was looking at the Permissions Reference for Meta Technologies APIs and I noticed a permission named user_posts that allows access to posts that user has made on their timeline. But I want access to any post(with all info like title, date, comments, etc.) that the user has access to. The user needs to copy and paste the url of the Facebook post to my application and I need to get access to the information on that post and work with it to give the desired output to the user.

Is this possible using Facebook OAuth? If not, is there any other way I can accomplish this?

I am attempting to follow several guides to implement a API access to our own google ads api. The goal is to load spend and campaign information to our internal data warehouse so we can build reports etc.. Pretty straight forward. oh no!

We use a SaaS tool called Celigo to build interfaces to API's in this case the google API. I have followed the guides, which have not been simple for me to understand:)

After several failed attempt, I finally thought I was on the right lines, I enabled the API in GOOGLE CLOUD under my project. set up a OAuth consent screen. I then attempted to create credentials. however I get this internal error to which after much google-ing I can't find any support for. Does anybody have any experience of this issue? or help my unblock this part ? thanks in hope!

The request failed because one of the field of the resource is invalid.

Expecting to create oauth credentials

FYI guides I have been following are https://www.youtube.com/watch?v=HXKpfGqPRy0&t=1042s https://docs.celigo.com/hc/en-us/articles/360060770192-Set-up-a-connection-to-Google-Ads#Client-Info3

I've been using 2 REST API calls to batch upload google offline click conversions. One generates the Access Token. The other is the API call to upload the offline click conversions.

All was well for a few weeks until suddenly we started getting invalid_grant messages in the JSON when trying to generate the Access Token. No clue why -- and we received no email or anything from Google on this. It just stopped working and the invalid_grant error was cryptic and the online help didn't explain much.

I resolved this issue by following this video to generate a new Refresh Token in the Google oAuth Playground:

https://youtu.be/KFICa7Ngzng

So, my question is -- can we automate this somehow? I can trap the invalid_grant JSON response and then would like to do some series of REST API calls to generate a new Refresh Token. Or, would I need to switch from a Web Application Type to a Service Account Type on the oAuth?

I also researched what might have caused the Refresh Token to expire. I looked at the following page and none of those bullet items applied to my situation:

https://developers.google.com/identity/protocols/oauth2#expiration

I am using a Google Ads php library (https://github.com/googleads/googleads-php-lib) to manage my own google ads account, following Google's instructions here (https://developers.google.com/adwords/api/docs/guides/first-api-call)

(I've actually been doing this for many years without a problem, but I recently switched over to using a different project in the Google Cloud Platform, so I had to update my credentials and get a new refresh token)

To get a new refresh token, I ran the php script called GetRefreshTokenWithoutIniFile.php (which allows me to grant offline access and retrieve a new refresh token, which I store in a file auth.ini for future use).

The refresh token last for a few days, before I see this error:

{     "error" : "invalid_grant",     "error_description" : "Token has been expired or revoked." } 

I have been using the above method for years and the refresh token has never expired. However, it now seems to expire every couple of days. I am certainly not 'running out' of refresh tokens (I only request one), and the user is not revoking access (the user is me). For that reason, these similar answers don't help me:

Any more ideas?