I am creating a Facebook bot using which user can chat with the Facebook page.
Following is the scenario:
Allow user to login with his Facebook account along with required
permissions
Show user list of his pages
When user select on of the page; subscribe MY FACEBOOK APP to
that page
Setup webhook for app
Send-Receive message to/from user's Facebook page
I am having trouble with 3rd point. I tried to subscribe app using following code as mentioned in facebook docs
FB.api(
'ACCESS_TOKEN',
'/<PAGE_ID>/subscribed_apps',
'POST',
{"subscribed_fields":"[\n \"feed\"\n]"},
function(response) {
// Insert your code here
}
);
and it returns following response:
{
"success": true
}
The problem is- I don't know which app is subscribed for this page; I can have 100 apps. Graph api don't have provision to provide app id which need to subscribe against user page.
This is facebook doc for subscription
In order to get page access token for app, you need to use same app to login user and to subscriber to user's page.
This makes total sense as user is granting our app to their pages and provide us access token with the reference of our app.
Solution :
Allow user to login with his Facebook account along with required
permissions and your Facebook app
Show user list of his pages
When user select on of the page; subscribe YOUR FACEBOOK APP to that
page using page access token obtained in step 2
Setup webhook for app
Send-Receive message to/from user's Facebook page
Related
I am implementing a social management tool.
LIKE there are 2 businesses BUSINESS_A and BUSINESS_B. Both of their Facebook pages are created using the same Facebook account (fb-page#xyz.com).
And the Facebook App I have created using fb-integration#xyz.com.
Now, I can not give fb-pages#xyz.com or fb-integration#xyz.com credentials to both businesses.
How can I generate an access key server side, without the user login as they are not the creator?
If I make their Email Id as admin on the page. Will that work?
I'm trying to access DocuSign account and app.
How to pass to docusign login without client_id, once login successful it will ask for app and send Integration Keys with Secret Keys of that app in callback?
Step1- User redirect to DocuSign login page with url somethings like this
Response.Redirect(WebUtilities.AddQueryString(Options.AuthorizationEndpoint, new Dictionary<string, string>{
{ "scope", "signature extended" },
{ "response_type", "code" },
{ "state", stateString },
{ "redirect_uri", Options.AppUrl + Options.CallbackPath.ToString() } })
);
and after successful login.
Step2. User should have screen with apps which are in setting and from there after selected any app, it will send Integration key/ Secret key of selected app to call back url. By which I want make calls are per my requirements.
Basic point is user from my web site click on docsign link- it will redirect to login of DocuSign - user will select app on successful login - select app which user want - After selection it will redirect to callback with with IntegrationKey and Secret key.
Hope I am clear now.
Unfortunately your question is not clear. Maybe you can edit it.
To make an API call to DocuSign, you need an access_token. Your application obtains an access_token by using an OAuth authentication flow such as Authorization Code grant or JWT grant.
To receive a webhook notification from DocuSign, you set up your Connect/webhook subscription by using the eSignature Administration tool. You do not need a client_id for this action.
Added
The OP has added to their question:
Basic point is user from my web site click on docsign link- it will redirect to login of DocuSign - user will select app on successful login - select app which user want - After selection it will redirect to callback with with IntegrationKey and Secret key.
I think the question is about authenticating an application's user with DocuSign, then returning to the application.
Answer
The OAuth security standards for the Authorization Code grant require that the user login via the OAuth service provider. In this case account.docusign.com or account-d.docusign.com.
There are two ways to do this:
The application redirects the user's browser to the OAuth service provider. After the first step in the Authorization Code grant flow, the user will be redirected back to the application. The application then makes the call to exchange the authorization code for an access token. The app needs a way to recover its state when the user is redirected back to it. There are several ways to do this.
The application can open a new browser tab to the OAuth service provider. The application continues to run in its original browser tab. The app can programmatically close the tab that it created once the user is authenticated.
Once your app has an access token for DocuSign, it can make API calls to DocuSign. Generally speaking, apps should make API calls to DocuSign on behalf of the user. It is less common for apps to show the DocuSign application to users.
The exception is the DocuSign Signing Ceremony, used for actually signing a document. But signers rarely have a login to DocuSign--they don't need a login to sign.
If you're going to show the DocuSign signing ceremony to your application's users then your application will usually obtain an access token for a system user such as "finance#example.com" (via OAuth JWT impersonation grant) not for the signer since the signer does not have a DocuSign login.
I have created a Web application that makes use of the Spotify Web API. Through the spotify Web API, I get the user's email (which they used to register their spotify account) after they authorize my app on their end. However, I don't store their emails in any database after they authorize. Is there a way I can retrieve the email list of all the users who authorized my app so far from my Spotify app interface?
I have built a Node JS Express Blank Web App using Azure Web App service.
Then, I have configured Facebook Authentication and inputted my app ID and secret, etc.
Then, it allows the feature that when I accessed the web URL of my web app, it will see if the user is logged in and ask for their permission.
But, what if I want them to click the facebook login button and then login in using facebook and display their Username and icon?
You can see the portal configuration here
Hopefully, the following will help.
1) Set Action to take when request is not authenticated to Allow Anonymous requests(no action) in the Azure protal.
2) Add authorization.json file and define URL Authorization Rules in this file to restrict access to certain resources within your app. More details, please check out this blog post.
3) Add facebook login button into your home page, while the button is clicked redirect the user to:
https://<yourwebsitedomain>/.auth/login/facebook?post_login_redirect_url=/welcome
this will navigate the user to /welcome after logging in.
4) Once the user logged in, you are able to get authenticated user info with this endpoint: https://<yourwebsitedomain>/.auth/me.
I've read through every resource our there on the servicestack wiki, examples on github, forums and stackoverflow to figure out implementing facebook integration with a mobile app and servicestack backend. However, none of them have the answer or I'm missing something basic.
In our workflow, a user decides to Register on through the mobile app using Facebook:
We contact Facebook requesting permissions to the user's account
User grants permissions (let's not worry about denied for now)
We get a user access token and everything is good so far
Next, we want to access our ServiceStack backend (using the Facebook Auth Provider) to create an account and automatically log the user in the first time. The examples refer to the method where a web browser is used. What if I want to pass the user auth token from my mobile app to the server to fetch the user permissions and create an account if it doesn't exist and then log the user in?
The existing endpoint seems to work only for a browser app because it also does a redirect. We need a way to pass in the user auth token and log the user in (or create an account if it doesn't exist). Any idea how this can be accomplished?
To login via OAuth in Mobile Apps, you'd typically launch a browser control to have it redirect to the remote OAuth site where it gets the users permission and captures their credentials just as it would with a website.
If you're developing a Mobile App using Xamarin the TechStacksAuth shows an example on how you can use Xamarin.Auth control to authenticate with a ServiceStack back-end via OAuth.