Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with implementing oauth #64

Open
mfvas opened this issue Nov 17, 2015 · 4 comments
Open

Problems with implementing oauth #64

mfvas opened this issue Nov 17, 2015 · 4 comments

Comments

@mfvas
Copy link

mfvas commented Nov 17, 2015

Hi

I'm completely new to app-development, but started recently to play around with PhoneGap. I'm trying to get authentication to work through Instagram with the oauth PhoneGap plugin, but nothing happens when I press the assigned button - the paragraph changes though. I'm trying it in the PhoneGap Developer emulator. I've also tried in a browser, where I get the following erros:

ReferenceError: module is not defined
module.exports = {
oauth.js (line 76, col 1)

ReferenceError: OAuth is not defined
OAuth.initialize('utIjrESXUntpPfz5t2tg_3pzODM');
app.js (line 26, col 2)

Here is my code:

<!DOCTYPE html> 
<html>
<head>
  <title>X</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
  <link rel="stylesheet" href="lib/jquery.mobile-1.4.5.min.css" />
  <link rel="stylesheet" type="text/css" href="css/index.css" />
</head>

<body>
<div data-role="page" id="pageone" class="pagewrapper">
    <div data-role="panel" id="rightpanel" data-position="right">
        <p>hej</p>
    </div>
    <div data-role="panel" id="leftpanel" data-position="left">
        <p>hej</p>
    </div>
    <div data-role='header' id="header" data-id='pheader' data-position='fixed' data-transition='none'>
            <span id="right-menu-toggle"><a href="#rightpanel"><img src="img/menu-toggle.png" width="25px" height="25px"/></a></span>
            <span id="left-menu-toggle"><a href="#leftpanel"><img src="img/settings-toggle.png" width="25px" height="25px"/></a></span>
    </div>
    <div role="main" class="ui-content">
        <button type="bytton" onclick="oAuthfct()">Instagram!</button>
        <p id="test">hej</p>
    </div>
</div>

<script src="cordova.js"></script>
<script src="../plugins/com.oauthio.plugins.oauthio/www/oauth.js"></script> 
<script src="lib/jquery-2.1.1.min.js"></script>
<script src="js/app.js"></script>
<script src="lib/jquery.mobile-1.4.5.min.js"></script>
</body>
</html>
function oAuthfct() {
    document.getElementById("test").innerHTML = "Paragraph changed!";
    OAuth.initialize('utIjrESXUntpPfz5t2tg_3pzODM');
    OAuth.popup('instagram', function(error, success){
  // See the result below
});
}
@angelxmoreno
Copy link

I am getting the issue. Could it be that the plugin no longer works?

@angelxmoreno
Copy link

Been playing/debugging this for a few days now. A few things I learned along the way:

  1. you are including the oauth lib in your HTML. You do not need to do this.
  2. the lib is not visible on web or emulators. Only on devices does the lib seem to work
  3. The lib is using a really old version of the oauth js sdk. The user management modules do not exist in this lib.

I created a function that checks if the app is running in a browser or a device. When in a browser, I inject the web version of oauth.io. My current issue is that the web version and phonegap versions are not the same. I will report back once I get this working 100%

@mfvas
Copy link
Author

mfvas commented Nov 28, 2015

Sounds promising. Good work!

@bumpmann
Copy link
Contributor

bumpmann commented Dec 8, 2015

I m not sure yet for phonegap (moreover it seems okay on cordova), but I just released the v0.5.0 to match the latest version of oauth js sdk so you can use the user management.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants