I've got the Live Stream box plugin working on my site using the code output from the developer documentation. What I want to do is when a user clicks login it asks for authorisation to use the app with the permissions e.g. email address, that I've requested in the auth part of the app. Is this possible?
use the scope parameter
see http://developers.facebook.com/docs/reference/api/permissions/
Related
Everything I have read (e.g. https://api.slack.com/docs/oauth) makes it seem as though I can only build an app that integrates with a Slack team I manage. E.g. I have to create my Slack Client ID .. etc ... and then I can oAuth users for my team.
What I want to do is allow my app's users to login to my app using their Slack login (for their Slack team I do not control or have access to.) I don't want to force my users to generate a Client ID to use my app. I want them to login the same way Google Login or Facebook Login works.
The closest thing I have found is a "login with slack" HTML button, but I'd like to do it in iOS using Swift.
Is that possible?
Sadly, that's not possible. For google or facebook, the way authentication works is that they provide you a mobile API which handles the communication between your app and their web service. So you task is simply adopt that API, make simple function call and retrieve information for user from the API. For example, the facebook button is provided by the API.
However from a look at slack site, they only have RESTful API documented. So in this case, you have to handle the passing and storing of parameters by yourself, and send HTTP request manually. You can have a look at Alamofire framework, which is the best choice for making HTTP request. Basically, you have to send needed parameter with the specific url though HTTP request to perform a log in action, and you have to parse the respond data and then see if the login is successful or not, etc
Thanks to some help from friends it looks like the answer is yes.
You must first make sure you "Distribute App"
Then set up the permissions you require and "install app" (which is a bit not "smart" since you can accidentally add conflicting permissions and get an error when trying to install).
Once that is done you will get an Auth Token and can make requests for any user to login using oAuth.
You can also trigger a sign in request like so:
https://slack.com/oauth/authorize?client_id=[client id]&scope=identity.basic
Edit: For future Googlers, Slack now also provides a specific documentation page for this type of OAuth grant/login: Sign in with Slack
I try to create actions for Google Home. For my new action I need to ask user authorization in my web site, I need to identified user. For this user should be find my action in Google Home app, linked on my web site and sign in.
My question in the next. Have I any chance to create all this using only emulator? Or without Google Home device I can't do anything?
You'll definitely be able to implement and test this just using the emulator, although it will not work as smoothly as if you had an actual device. The procedure is known as "account linking" and is detailed at https://developers.google.com/actions/develop/identity/oauth2-overview, but in general the flow is:
Your service needs to act as an OAuth 2.0 server and have an authorization page and a token exchange endpoint available to the Google Assistant.
When the user activates your Action for the first time, they're told they need to give Home permission to access your account and they should check the Google Home app for a card.
The card will redirect them to the authorization page, where they log into your website and authorize access to your site from Google Home.
As part of authorization, you'll continue the OAuth 2.0 flow and will (eventually) issue a bearer token that Google Home will store.
Users can then re-trigger the Action. Every time your webhook is called, Google Home will send this token to you.
You can then use this token to lookup which user is making the request.
There are a lot of additional details, which are covered in Google's documentation and in the OAuth 2.0 specification, but this is generally how it works.
For the emulator, users are not directed to the card in the Google Home app. Instead, you can see in the return JSON provided by the emulator the first time you activate the Action. In it, the debugInfo.sharedDebugInfo.debugInfo field contains the authentication URL. You should go to the URL in a browser, complete the sign-in and authorization flow, and will eventually be redirected to a URL that includes the parameter result_code=SUCCESS. After this, using the emulator will send the access token to your webhook. See https://developers.google.com/actions/tools/testing#testing_on_the_google_home_web_simulator for additional details.
I'm writing a VC++ app and I would like to allow users to login via Facebook. Looking through the documentation, it looks like they only support php on servers, JavaScript, and native mobile clients.
Right now what I'm thinking of doing is to open a browser window in the app, have the user authenticate, and then grab the auth token to do native app calls.
The other thing I was thinking of is having the user enter the Facebook username and password into my app and then using that directly, but I'm not sure if that's allowed.
How do I authenticate a desktop app with Facebook?
Right now what I'm thinking of doing is to open a browser window in the app, have the user authenticate, and then grab the auth token to do native app calls.
Actually you are on the right track: Facebook provides you with a so called "Manual Flow".
So this is how you authenticate your users with Facebook in your app in three steps:
Step 1
When the user should login to Facebook, open the embedded browser and point to this url:
https://www.facebook.com/dialog/oauth?client_id={app-id}&display=popup&redirect_uri=https://www.facebook.com/connect/login_success.html
Three things to note here:
Of course, you need to replace {app-id} with your application's id.
The redirect_uri must be set to https://www.facebook.com/connect/login_success.html when using a desktop application (that's your case).
You can also specify additional parameters, for example if you need to request extended permissions from the user (publish_actions, etc.). See the full list of optional parameters for more information.
Step 2
Make sure you have enabled the following switches in your app's advanced settings:
For security reasons, you should enter https://www.facebook.com/connect/login_success.html under "Valid OAuth redirect URIs", but it worked for me without explicitly setting this.
Step 3
Now the redirection by the Facebook servers should navigate the browser window to the redirect uri from above. It will also include the access token in the uri's fragment as follows:
https://www.facebook.com/connect/login_success.html#access_token=ACCESS_TOKEN...
Use the ACCESS_TOKEN in order to make any subsequent calls to the Facebook API - et voilà!
We are integrating an application as a facebook app at work. I want to be able to detect whether the user has logged in to facebook, and if not, to prompt for authentication.
So far we have successfully used the facebook SDK and the login functionality it provided. However, this causes an authentication popup window to be created by our application, and it is being blocked by most of the browsers, so our priority task is to re-implement the authentication logic not to use popups.
According to the this tutorial from the facebook documentation it could be done either by using event subscription for user status change requests (which did not work when the user is logged out) or by obtaining access token. The problem is that the token is returned as request parameter to the top window (the url I specify as a return url after the user authenticates). Since some cross-domain and browser restrictions exist, I am unable to use client scripting to obtain the value, and I am stuck.
Related questions here have been asked and the common issue is that most apps are being ran on localhost. However, the case with our app is that we have deployed our app to local webserver, that is exposed by a public domain, but still has the cross-domain restriction issues. It is being referenced by its public domain name within the facebook app configuration. I am completely confident in that the domains are fully accessible from outside.
In general, our case is that we would like to host the app while it is being used by facebook users. Perhaps this approach might be incompatible with our requirement? Is it possible to configure cross-domain communication to avoid the issue? Are any other ways to do avoid facebook login popups?
First of all, default settings for popup blockers in modern browsers are so that they only block popups that are called without user interaction. If you call FB.login automatically on page load, it is likely to get blocked. But if you offer a link/button to the user saying “log in here” and only call FB.login on click on that link/button, then the popup is rather likely to be shown and not blocked.
If you are not willing to do it that way – then your other option is to use the server-side auth flow. You can just redirect the user to the auth dialog, which will happen in the same window, and he will be directed back to your app afterwards.
I'm new to all this. This is what i'm after and i'm sure it's possible.
I've got a script where people can register/login in to as members. What i'd like to do is tie it in so that it just uses Facebook users details for the registrations. I've managed to set it up to sign up and and complete a registration using a user's name and email.
What i'd like to do now is automatically log the user in if they're logged in on facebook, is this possible or will they need to click a login button that then takes them to their page? If they need to click a button to login, how do I go about getting the button to take their facebook details and log them in? Also what happens in regards to passwords on my site? Is that stored in the app somehow?
Ideally i'd like to use the popup version of verification rather than the iframe that i've got set up at the moment.
Cheers in advanced for any help for a n00b!
This is in fact possible. Although I for my part was never a fan of such things here's some human-readable (simplified) theory:
Facebook uses a system called OAuth ( http://de.wikipedia.org/wiki/OAuth ). That means, when you want to have the user login onto your site using Facebook you'll of course need to provide a button/facebook-login-frame (see documentation) that says "Log me in with Facebook" or so. You then access Facebooks API (more here: https://developers.facebook.com/ ) and basically tell Facebook who you are ("Hi I'm website XY"). While that happens your user is redirected to Facebooks "permission-landing-page". On that page he needs to confirm whether he is fine with your website accessing certain information (like his name). If he confirms your website receives an access-token granting you access to a subset of his user information which you can then use to personalize his expeirence on your website.
Check out facebooks documentation because they explain exactly your usecase in detail.
(here: https://developers.facebook.com/docs/authentication/ )
PS: You'll of course never have any access to his Facebook login/password. That's kind of the idea behind "delegating" the authentication via OAuth to Facebook. Facebook only provides you with an access token (bound to that particular user who logged in and granted your app/website permissions)