I am facing difficulties implementing social authentication (using Google, Facebook) in a Worklight app with the Android and iOS environments.
I am trying to use oauth. The following are requirements:
var OAUTHURL = 'https://accounts.google.com/o/oauth2/auth?';
var VALIDURL = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=';
var SCOPE = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email';
var CLIENTID = '97612631714.apps.googleusercontent.com';
var REDIRECT = ??????
var LOGOUT = 'http://accounts.google.com/Logout';
After authentication it should be redirected to our app (is located in public domain). For that we have to add a redirect uri to Google API.
I don't know what should be put in REDIRECT.
The normal cycle will not work in a Hybrid application because your app does not have a public URL.
Here is one person who documented his experience doing something similar:
http://www.itsalif.info/content/oauth-google-api-gapi-phonegap-childbrowser-jquery
Also:
https://github.com/andreassolberg/jso/blob/master/README-Phonegap.md
Also a twitter/android example: http://www.mobiledevelopersolutions.com/home/start/twominutetutorials/tmt5p1
Related
I am trying to follow Zoho's guide for getting authorized via OAuth. Unfortunately, the guide seems a little outdated as the API Console doesnt look like the screen shots provided in the guide.
This is what I am trying to accomplish
I'm developing a windows client application. So naturally i chose the Non-Browser Application for my zoho client (in the API Console). Using this client type there is no "Authorized Redirect URIs".
So how am i supposed to get authorized to start using the Zoho APIs?
Currently, i've tried various client types w/ various redirect uris (bogus). I am getting an http code response of 500.
I am basically calling an HttpClient GetAsync(requestUrl ) where requestUrl is defined below:
var scopeValue = $"{scope}&client_id={clientId}&client_secret={secret}&response_type=code&access_type=offline";
var requestUrl = $"https://accounts.zoho.com/oauth/v2/auth?scope={scopeValue}";
Question
Why am i getting a 500 error when i invoke this GET request to get authorized?
Am I choosing/configuring the wrong zoho client type?
Is there a difference between a Zoho Account Id and User Id (this MIGHT be one of my problems)?
Just for FYI, here is the Zoho API Console with the various client types to choose from:
Try going to a different requestUrl. I believe you should be going here. You should also be using a POST request. I chose the Non-Browser Application for my zoho client (in the API Console). And I am able to get a response.
https://accounts.zoho.com/oauth/v3/device/code?client_id=xxxx&scope=ZohoProjects.tasklists.READ&grant_type=device_request
I wrote this in VBA only for trouble shooting this question.
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
Url = "https://accounts.zoho.com/oauth/v3/device/code?" & _
"client_id=xxx&" & _
"scope=ZohoProjects.tasklists.READ&" & _
"grant_type=device_request"
objHTTP.Open "POST", Url, False
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.Send ("")
replyTXT = objHTTP.responseText
Debug.Print (replyTXT)
I believe this link has some helpful information.
https://www.zoho.com/accounts/protocol/oauth/devices/initiation-request.html
I'm trying to implement Steam Authentication via OpenID for iOS using this framework. I already translated the demo to Swift 3 and made it work with Google. Now I'm trying to get it to work with Steam and I don't know where to find some of its configuration. To make the app work with Google I use this information:
let kClientID = "xxxxx.apps.googleusercontent.com"
let KRedirectURI = URL(string: "com.googleusercontent.apps.xxxxxx:/oauthredirect")
let kIssuer = URL(string: "https://accounts.google.com")
I've being looking in their dev wiki but so far I could just find how to get the API key. Would you have this information? It is my first contact with OpenID and I'm a bit lost.
Thanks for any help
I previously asked a question about doing this in MVC4 and found my own solution.
How to use Facebook Login v2.0 with dotnetopenauth OAuthWebSecurity.RequestAuthentication
I am upgrading my project to MVC5 so I'm moving to Facebook authentication with OWIN security rather than oAuth. In MVC4 I implemented my own Facebook client so that I could override the default authentication endpoint URL to use the V2 URL. I can't see how I can do this using app.UseFacebookAuthentication because it doesn't take a client parameter.
Facebook require all apps to use the v2 login by April so I'm really surprised that I can't find any existing questions on this. Can anybody help please?
To clarify the changes that Bruno suggested:-
Upgrade Microsoft.Owin.Security.Facebook to 3.0.1
In Startup.Auth.cs
the call to app.UseFacebookAuthentication should be changed to look
like something like this (note that this is NOT just 3 extra lines
for the endpoints):-
app.UseFacebookAuthentication(new FacebookAuthenticationOptions
{
AppId = facebook_appId,
AppSecret = facebook_appSecret,
AuthorizationEndpoint = "https://www.facebook.com/v2.2/dialog/oauth",
TokenEndpoint = "https://graph.facebook.com/v2.2/oauth/access_token",
UserInformationEndpoint = "https://graph.facebook.com/v2.2/me"
});
I had the same problem yesterday. Please check this working item of the katana project:
https://katanaproject.codeplex.com/workitem/363
Check this also:
https://katanaproject.codeplex.com/SourceControl/network/forks/Tratcher/Katana/contribution/7720#!/tab/changes
I have updated to the latest nuget pakage and this is already available. So, you can now change the authentication endpoints when creating FacebookAuthenticationOptions. This worked for me and is already in production. I had just one problem: the old application cookie was not recognised, meaning that all users will have to authenticate again.
I'm currently working on an iOS app which will (if I can figure out this problem) use Azure as backend. The user is supposed to login with their iOS account which they already setup on their iOS device. I than use reverse authentication (https://dev.twitter.com/docs/ios/using-reverse-auth) to get the user's access token and I would like to use said access token to login the user.
I tried using (Swift snippet)
let tokenDictionary = ["access_token": "<token-I-got>"];
client.loginWithProvider("twitter", token: tokenDictionary.bridgeToObjectiveC(), completion: {(user: MSUser!, error: NSError?) in
if let user = user? {
print(user.userId)
} else if let error = error? {
print(error)
}
})
but the only thing the API returns is:
POST of Twitter token is not supported.
Any ideas how I could get this to work or do I have to switch away from Azure to something different? (And using the webview for login is not an option, as we have this nice already accounts on iOS already setup with the credentials).
Thanks for helping.
This feature is not currently supported by Azure Mobile Services. You can upvote the feature request here.
I have an ASP.NET MVC 3 application with some Facebook integration using the Facebook C# SDK with cookie support switched on.
I had planned (and would still like) to create a canvas Facebook application as an Area of the main application. The problem is that canvas applications require that cookie support be turned off. Is there anyway to override this setting in the Area, or am I stuck?
Update 11/01/2011
I used the location node in web.config in order to override the cookieSupport setting.
<location path="facebook">
<facebookSettings
appSecret="***"
appId="***"
cookieSupport="false" />
<canvasSettings
canvasPageUrl="http://apps.facebook.com/***/"
canvasUrl="http://www.***.co.uk/facebook/"
authorizeCancelUrl="http://apps.facebook.com/***/home/cancel" />
</location>
It appears to authenticate users who have already authorised the app without issue. However users who're have not yet authorised do not get authenticated (they don't see the permission dialog).
I should stress that the configuration works as expected when the structure of the Area 'facebook' is put into an app of it's own.
Rich
Even if you can't do it via an area-specific web.config file, you could always just skip the settings in the web.config and set them manually:
FacebookSettings facebookSettings = new FacebookSettings
{
AppId = yourAppId,
AppSecret = yourSecret,
BaseDomain = yourDomain,
CookieSupport = false,
MaxRetries = 2,
RetryDelay = 500
};
var app = new FacebookApp(facebookSettings);
This turned out to be an issue somewhere between ASP.NET MVC3 RC2 and the Facebook C# SDK 4.1.1. See http://facebooksdk.codeplex.com/workitem/5794 for details.
The issue has since been resolved in version 4.2.1 of the SDK.
Rich