Giter Site home page Giter Site logo

ng-cordova-oauth's People

Contributors

akshayrangnekar avatar amit777 avatar ant0ha avatar antonshevchenko avatar awsnonsolum avatar ballmw avatar bbuie avatar chocksmith avatar davidruisinger avatar finalspy avatar gregmcpugh avatar gvhuyssteen avatar hackeo1 avatar jdnichollsc avatar jinasonlin avatar kromkens avatar matheusrocha89 avatar michaeleparkour avatar mrpro100 avatar nraboy avatar palumbon avatar pooyaj avatar pungoyal avatar pythagorascal avatar seiyria avatar stranger82 avatar visiongeist avatar vlamic avatar webdevius avatar yalamber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ng-cordova-oauth's Issues

Problems with Foursquare

I Have this code that works fine on Emulator, but with device doesn't do anything

User.controller "UserController", ($scope, $cordovaOauth) ->
$scope.CLIENT_ID = "FOURSQUARE_CLIENT_ID"

$scope.login = ->
$cordovaOauth.foursquare $scope.CLIENT_ID
.then (result) ->
console.log "Response Object -> " + JSON.stringify result
.then (error) ->
console.log "Error -> " + error

I don't known what i'm forgetting

“unsupported_response_type” ?

i am trying to use $cordovaOauth.google(..) as sample does..
but the status from google is 400 and shows "Error:unsupported_response_type".

How can i solve it?

thx.

Linkedin returns "Problem authenticating" even when it's returning the token

Hello,

I am trying to authenticate my users via Linkedin but I always get "Problem authenticating". After digging for a long time, I activated my proxy and I see that in fact I am receiving the correct data and response code in the form of

{"access_token":"xxxxx x x x xxxx x","expires_in":5183999}

and I can see the 200 OK response code in the header.

However, when I log the returned data in .error(function(data, status){... I get null. .success(function(data) {... is never called

Please merge dev branch to master

Hi. I add Odnoklasniki provider and you acept my pull request to dev branch. Please merge dev branch to master and pull requested it to ng-cordova. It would be desirable to have everything in one place. Thanks

Invalid redirect uri : http://localhost/callback

Hi,
I am using ionic framework and iOS platform. I have created URL for callback as mentioned.

However I am getting error as invalid redirect uri, Could you please let me know what I am doing wrong.

Regards,
Suhas

Error 32 ( Authentication Error ) on Twitter Search API

Hi guys,

I have read many threads on this topic, including: #45
and http://blog.ionic.io/displaying-the-twitter-feed-within-your-ionic-app/ but I suspect I might be missing something here. I'm using "ng-cordova-oauth": "~0.1.0" since it should have the latest fix for related problems.

Problem: "Data: {"errors":[{"code":32,"message":"Could not authenticate you."}]}" from $http.get(url)... on iOS where var url = 'https://api.twitter.com/1.1/search/tweets.json?q=%40twitterapi'; (Twitter Search API)
Note: This Twitter Status API URL (same as the tutorial by @saimon24) would work fine though 'https://api.twitter.com/1.1/statuses/home_timeline.json'. I could get the correct data back.

I also followed Simon's post by calling this prior to the API call


function createTwitterSignature(method, url, queryObj) {
    var token = angular.fromJson(getStoredToken());
    var oauthObject = {
        oauth_consumer_key: clientId,
        oauth_nonce: $cordovaOauthUtility.createNonce(10),
        oauth_signature_method: "HMAC-SHA1",
        oauth_token: token.oauth_token,
        oauth_timestamp: Math.round((new Date()).getTime() / 1000.0),
        oauth_version: "1.0"
    };
    var signatureObj = $cordovaOauthUtility.createSignature(method, url, oauthObject, queryObj, clientSecret, token.oauth_token_secret);
    $http.defaults.headers.common.Authorization = signatureObj.authorization_header;
}

Anyone know why it I got code 32 only on the search API?

Thank you,
ari

not get facebook account info when login

My implement is ionic , ngCordova to build android app
I use ngCordovaOauth to do facebook login
But when press login button I call
$scope.facebookLogin = function() {
$cordovaOauth.facebook("CLIENT_ID_HERE", [""]).then(function(result) {
// results
}, function(error) {
// error
});
}

Then it open window facebook login require type Email/ password to login, why it dont get facebook logined account on my android phone device and then just ask accept only ...?

code and token needed for google plus

Hello again. I successfully have this working with Google, but the problem is that the access token expires in an hour. To get around this problem, Google recommends a hybrid server-side flow "where a user authorizes your app on the client side using the JavaScript API client and you send a special one-time authorization code to your server". However, to implement, I need the access code returned by Google and this library only returns the token.

Thanks again for your help and excellent open source libraries.

Twitter OAuth does not work

I tried OAuth with twitter with all the recommended settings as mentioned in site. I notice a problem where in , the promise always gets rejected with message
The sign in flow was canceled

Windows Live Connect support

Hello guys,

I successfully integrated facebook and google services on my app, but now I also have to integrate Windows Live Connect login service.

Does this plugin support it?

I checked the list of services available and it is not present, a lot are, but not live connect.
Can it be supported? I know Windows was a small market-share, and it's somehow forgotten but some love will be appreciated. =)

Thank you.

How to get the refresh_token?

I'm using ng-cordova-oauth in my Ionic/Cordova app to authenticate my app users with google. This all works fine, but the response does not provide me with a refresh_token. As I understand it now, it turns out that ng-cordova-oauth

uses the Implicit grant type of OAuth 2.0, which per the specification is meant for "clients implemented in a browser using a scripting language such as JavaScript". With this flow the client is directly issued an Access Token, and only that.

So as far as I understand from [these google oauth docs[(https://developers.google.com/accounts/docs/OAuth2#scenarios) I need to obtain the Authorization code from within the app, send this Authorization code back to my server, and then obtain the access_code and refresh_code from my server. Is that correct?

And if I'm correct, can I use ng-cordova-oauth to obtain the Authorization code? All tips are welcome!

'The sign in flow was canceled' issue

Hi,

I'm trying to login with Twitter, i've followed the procedure:
-cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git
-set http://localhost/callback as the callback / redirect uri

  • add sha1.js
    Here is my problem, when I login on twitter, I received the following error: "The sign in flow was canceled". So I jump into your code, and I found this lines:
    browserRef.addEventListener('exit', function(event) {
    deferred.reject("The sign in flow was canceled");
    });
    So I tried to comment it, and the authentification succeeded. Is it possible the exit event could be send before then end of the authentification process ? Or Am I simply doing something wrong ?
    Thanks

Refresh token

Very nice, but it's missing the ability to refresh the token, or am I missing something?

Getting error after connected with social network (fb and google_plus) on WP8

I am getting error as shown below after login with fb or gplus social network. Please help. How to resolve that issue. It is getting on WP8 device only same code works fine on Android and iPhone. Please help me to solve this problem.

ERROR:TypeError: Unable to get property 'addEventListener' of undefined or null reference
   at google (x-wmapp0:www/js/ng-cordova.js:2829:11)
   at $scope.connectToGP (x-wmapp0:www/js/controllers.js:426:5)
   at Anonymous function (x-wmapp0:www/js/angular.min.js:177:56)
   at Anonymous function (x-wmapp0:www/js/angular-touch.js:419:9)
   at k.prototype.$eval (x-wmapp0:www/js/angular.min.js:112:57)
   at k.prototype.$apply (x-wmapp0:www/js/angular.min.js:112:322)
   at Anonymous function (x-wmapp0:www/js/angular-touch.js:418:7)
   at b.event.dispatch (x-wmapp0:www/js/lib/jquery.min.js:3:28281)
   at v.handle (x-wmapp0:www/js/lib/jquery.min.js:3:24972)
CordovaBrowser_LoadCompleted
A first chance exception of type 'System.SystemException' occurred in Microsoft.Phone.Interop.ni.dll
Error calling js to fire nativeReady event. Did you include cordova.js in your html script tag?

CordovaBrowser_NavigationFailed :: https://accounts.google.com/o/oauth2/approval?hd=gmail.com&as=3fxxxxxx85797c2e&hl=en_GB&pageId=none&xsrfsign=APsBzxxxxxxAVL0BVElnqr8hP67xxxxxxxxxxTzSrVPG

Problem w/ implementing Venmo OAuth.

I've been trying to implement Venmo OAuth – these are the settings I currently have set:

screenshot 2015-02-07 11 06 52

app.coffee, with my routes: https://gist.github.com/arjunblj/626f3be50d9233b9af3c
controllers.coffee: https://gist.github.com/arjunblj/f014ba685947cc2e223e
login.html, the main login template: https://gist.github.com/arjunblj/2eede80e4ea4e572b935

I was first having issues with setting the callback to http://localhost/callback as it didn't have the Ionic port. I tried adding the port (the one ionic serve attaches) and it was working on web but was giving me issues on the simulator/iPhone. It was solved int he simulator when I used my computer's hostname.

Would love to know what a good pattern for this is. Thanks!

usage example uses a deprecated google scope

As per google's login scopes doc the scope userinfo.email scope featured in the example in the README is deprecated.

Since many people blindly copy/paste the sample code, me thinks the example should be updated.

For now the non deprecated, oauth based equivalent seems to be https://www.googleapis.com/auth/plus.profile.emails.read, while the "real" equivalent would be OpenID Connect's email but this plugin doesn't handle this, does it?

Is there a way to make it work in the browser

I would like to know if it is possible to perform the authentication with facebook using the browser because I get the error "Cannot authenticate via a web browser".

I am wondering also what is the main difference between the ng-cordova-oauth project and the ng-cordova with the $cordovaOauth plugin?

Thanks

Getting 215 from Twitter half of the time

Hi,

Thanks for the lib, working great for our project.
I have a really weird issue though: we have twitter/fb signin buttons and link buttons if you're logged in and haven't linked your account. The signin buttons work perfectly fine and so does the fb link one.
However, the twitter linking button always fail with the following error:

{"errors":[{"code":215,"message":"Bad Authentication data."}]}

This is really odd as I wrapped my use of ng-cordova-auth in a service and so both buttons calls the exact same method with the same params, I checked the keys they are identical in both calls so the issue must be something to do with the generated params for the call to https://api.twitter.com/oauth/request_token.

Here are the signature obj for both requests

// works
{"signature_base_string":"POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Dhttp%253A%252F%252Flocalhost%252Fcallback%26oauth_consumer_key%3Dsb5Q5NWvtyRmNjDX3QBZQfqOI%26oauth_nonce%3DsobE3HKFkP%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1426710378%26oauth_version%3D1.0","authorization_header":"OAuth oauth_consumer_key=\"sb5Q5NWvtyRmNjDX3QBZQfqOI\",oauth_nonce=\"sobE3HKFkP\",oauth_signature_method=\"HMAC-SHA1\",oauth_timestamp=\"1426710378\",oauth_version=\"1.0\",oauth_signature=\"NxLNWpif%2FZe16%2BOzCzV99MjAy0Q%3D\"","signature":"NxLNWpif%2FZe16%2BOzCzV99MjAy0Q%3D"}

// fails
{"signature_base_string":"POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Dhttp%253A%252F%252Flocalhost%252Fcallback%26oauth_consumer_key%3Dsb5Q5NWvtyRmNjDX3QBZQfqOI%26oauth_nonce%3DFvblLjrY1j%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1426710389%26oauth_version%3D1.0","authorization_header":"OAuth oauth_consumer_key=\"sb5Q5NWvtyRmNjDX3QBZQfqOI\",oauth_nonce=\"FvblLjrY1j\",oauth_signature_method=\"HMAC-SHA1\",oauth_timestamp=\"1426710389\",oauth_version=\"1.0\",oauth_signature=\"vcAxp1IjgmtdMy7UyZx86A0aOUQ%3D\"","signature":"vcAxp1IjgmtdMy7UyZx86A0aOUQ%3D"}

Any clues ?
Cheers

Twitter login - No 'Access-Control-Allow-Origin' header is present on the requested resource.

Hi,
I have problems with getting the $cordovaOauth.twitter working in my ionic app. The full error message is:

"XMLHttpRequest cannot load https://api.twitter.com/oauth/request_token. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mywebsite.com' is therefore not allowed access. "

My config.xml has the following entry:

  <access origin="*"/>

Is this a bug, or am I missing something?

ionic version: 1.0.0-beta.14
ng-cordova-oauth version: 0.0.8

Upgrade to Graph API v2.x

I got message when login to Facebook with ngCordovaOauth: You must upgrade this app to Graph API v2.x, v1.0 will be deprecated on April 30, 2015

Twitter Ouath

$scope.twitterlogin = function(){
$cordovaOauth.twitter('my_key','my_secret').then(function(result){
$log.info("result "+JSON.stringify(result));
alert("result" + JSON.stringify(result))
}, function(error){
$log.error("error "+error);
});
}

While running this code, I am getting an error "null"
I have set my call back url to : http//localhost/callback
What is wrong ? I am working on ios platform iOS 8.1

strange behaviour on firefoxos

Hello all, I need some help.

I want to login using a github account but I have an strange behaviour in my app, after I've logged in on github, the app redirects to my index but it seems that the app embeds the index instead of redirecting to it. See the image below.
firefoxos

You can see here my app.js code and also the manifest.webapp code.

my login function:

$cordovaOauth.github('27879518b3200cb586da', '3451fe872df74723655133d8e2c20c68417a4079', ['email'])
.then(function(data){
  console.log(data);
  $rootScope.user = data;
  $rootScope.$apply($rootScope.user);
  $rootScope.userStatus = true;
  $state.go('home');
}, function(err){
  alert(err);
});

And the app manifest:

{
  "launch_path": "/index.html",
  "installs_allowed_from": [
    "*"
  ],
  "version": "0.0.1",
  "name": "github-issues",
  "description": "An app for manage your issues at github",
  "developer": {
    "name": "Mozilla El Salvador",
    "url": "http://carloscarcamo.me"
  },
"icons": {
    "60": "/icon/icon-60.png",
    "128": "/icon/icon-128.png"
  },
"redirects":[{
    "from":"http://localhost/callback",
    "to":"/index.html"
  }]
}

Note: the redirects at the end of the app manifest is necessary because firefox simulator gives 404 error with http://localhost/callback, so I redirect from http://localhost/callback to my index.

Any thoughts about what i'm doing wrong?

Prevent cannot GET /callback screen from showing

When returning from the Google OAuth flow, there is a screen that says "Cannot GET /callback" that disappears quickly, however I would like to know if there is a way to make it disappear quicker or if it is possible to display custom text such as "Signing in..." in it's place. That screen looks like an error and isnt anything I would like my end users to see.

Could not find InAppBrowser plugin

I've an issue with ng-cordova-oauth that throw an error every time I want to use one of the provider (I tried with facebook and linkedin). Looking at the code, I believe this line is wrong:

if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true)

Not sure why this is happening but it looks like the correct slug should be cordova-plugin-inappbrowser now (output given by $> ionic plugin list).

Let me know if I can help :)

New provider request (Pinterest)

I have a hard time to add "Pinterest" support by myself. Is there someone more familiar with OAuth who will be able to add it to this great plugin?

ng-cordova-oauth is overriding $http.defaults in my application

Hi,
Today I've found some strange behaviour after triggering some requests.
My app:

The problem I've found, step by step:

  • Fail local signin with e-mail and password that do not exist (response ex. 404)
  • Open Twitter login with $cordovaOauth.twitter() method, and cancel the process (back button in android)
  • Again trigger local signin with same login/pass like previously and got different responce (400 BAD REQUEST)

I was scretching my head what had just happened there, but Chrome Dev Tools explained everything.
After the twitter request from cordova0auth, requests to my own backend contained Twitter's Authorization header.
The fix is quite simple: http://stackoverflow.com/questions/11876777/set-http-header-for-one-request
If i find some time this weekend I could do a pull request for you.

Best regars,
Łukasz

Google errors with "Cannot authenticate via a web browser"

I was following along with the readme, and this is the snippet of code I'm using to auth with Google:

  $cordovaOauth.google("RANDOM_NUMS_AND_LETTERS_HERE.apps.googleusercontent.com", ["[email protected]"])
    .then(function(result) {
      debugger;
      console.log("Response Object -> " + JSON.stringify(result));
     }, function(error) {
      console.log("Error -> " + error);
    });

The above code always ends up erroring, and here's the output:

Error -> Cannot authenticate via a web browser

Any advice?

Error 32 ( Authentication Error ) on $cordovaOauth.twitter

I have been using ng-cordova-oauth for about 2 months without issue. However now, I the token request always returns error 32. I have verified the client key and secret. I have looked at what is encoded for the signature. I have used the same client key/secret using twitter's oauth tool. Works succesfully with Twitter's generated headers but not the ones from this library. I am at a bit of loss how to continue to debug this. I have played with app permissions on twitter. Nothing seems to get this to return.

Re-sign in and authorize each time for Google

The re-sign is due to
clearsessioncache=yes,clearcache=yes
in window.open()

If this is removed, you no longer have to log in each time.

Having to authorize each time is due to
approval_prompt=force

If you change that to approval_prompt=auto, you don't have to authorize each time.

The window wasn't closing every time after making these changes. Adding a timeout around the close call seems to have fixed this:

setTimeout(function(){
    browserRef.close();
}, 10);

Error: Could not find InAppBrowser plugin when using in ionic

followed the instructions in the readme to add the to the project and also added the plugin to cordova using

cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git

but am getting the error " Could not find InAppBrowser plugin"

IOS webView:didFailLoadWithError - -1004

I'm running into an issue with Ionic and logging in via LinkedIn. Inappbrowser opens as expected, but upon logging in via the LinkedIn dialog / page I'm getting the following error:

webView:didFailLoadWithError - -1004: Could not connect to the server.
&
Error -> Problem authenticating

Any thoughts? I'm not doing anything fancy outside of the demo code - here's my payload code:

$scope.loginWithLinkedIn = function(){
var clientId = "ID";
var clientSecret = "SECRET";
var appScope = ['r_basicprofile'];
var state = "dev-09999";

$cordovaOauth.linkedin(clientId, clientSecret, appScope, state).then(function(result) {
console.log("Response Object -> " + JSON.stringify(result));
}, function(error) {
console.log("Error -> " + error);
});

};

I should add that I'm using the latest version of Cordova and cordova-plugin-inappbrowser 1.0.1-dev

dropbox -- what is app key [can we make dynamic]

Hi,
Thanks for an excellent plugin, I want to use this in my mobile app, however I want to provide my user to push some files on their dropbox, in such cases how app key can be dynamic? do users have to register an app in dropbox first.

Regards,
Suhas

Problems with linkedin provider?

I am unable to get the linkedin provider working:

$cordovaOauth.linkedin(string clientId, string clientSecret, array appScope, string state);

Can you provide a code sample for this?

I am successfully using the Facebook provider.

Add Re-Request Feature To Facebook

Allow the application to request permissions after the user has already denied them. Documentation for rerequest can be seen here:

https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.2

According to the documentation, the following code would do the trick:

https://www.facebook.com/dialog/oauth?
    client_id={app-id}&
    redirect_uri={redirect-uri}&
    auth_type=rerequest&
    scope=email

The particular parameter is auth_type=rerequest and should be used with caution.

Persistent sign in

Hey,
Thank you for your very useful lib. Works great. But one question:

  • how do you handle persistent login? With your plugin, the user has to sign almost each times the app starts. This is a real problem. On the apps I use everyday I just have to sign in once and then it's working fine until I log out.

Any idea to implement this securely?

Example of retrieving additional data after login?

I'm attempting to make a request to https://api.twitter.com/1.1/account/verify_credentials.json to retrieve the user profile information after login.

Something like (which I can't seem to get working):

var oauthObject = {
    oauth_consumer_key : '[key]',
    oauth_nonce : $cordovaOauthUtility.createNonce(10),
    oauth_signature_method : 'HMAC-SHA1',
    oauth_timestamp : Math.round((new Date()).getTime() / 1000.0),
    oauth_version : "1.0",
    oauth_token : data.oauth_token // returned from $cordovaOauth.twitter()
};

var signatureObj = $cordovaOauthUtility.createSignature("GET", "https://api.twitter.com/1.1/account/verify_credentials.json", oauthObject, oauthObject, '[secret]');

$http(
    {
        method : 'JSONP',
        url : 'https://api.twitter.com/1.1/account/verify_credentials.json',
        params : angular.extend(oauthObject, {oauth_signature: signatureObj.signature})
    });

Could I say thankyou?

I've been struggling with this for 2 days. I tried your dropbox call and it just worked - thank you!
Kevin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.