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

Usage of angular-oauth1-client #1

Closed
ppeczek opened this issue Sep 2, 2015 · 11 comments
Closed

Usage of angular-oauth1-client #1

ppeczek opened this issue Sep 2, 2015 · 11 comments

Comments

@ppeczek
Copy link
Contributor

ppeczek commented Sep 2, 2015

Hi, provided readme is quite empty, so I'm gonna ask here how to use your library.
In usage part you just showed how to send requests after authorizing. I suppose all happens in:
oauth1Client.authorize();
Therefore, should I provide my secret key and public key directly in your library?

Also after inserting your example code to my controller I get error: "oauth1Client is not defined". Putting it as provider also doesn't help:
angular.module('myModule.ctrl', [])
.controller('MyCtrl', function($scope, oauth1Client) {
I get error: "Unknown provider: oauth1ClientProvider <- oauth1Client <- ScheduleCtrl"

Thanks!

@zjleblanc
Copy link

Take a look at line 230-231 to see how we provided the consumer key and
secret. We just passed them along with the configuration settings.

Best,
Zachary LeBlanc
Notre Dame '16

On Wed, Sep 2, 2015 at 8:28 AM, Piotr Pęczek notifications@github.com
wrote:

Hi, provided readme is quite empty, so I'm gonna ask here how to use your
library.
In usage part you just showed how to send requests after authorizing. I
suppose all happens in:
oauth1Client.authorize();
Therefore, should I provide my secret key and public key directly in your
library?

Also after inserting your example code to my controller I get error:
"oauth1Client is not defined". Putting it as provider also doesn't help:
angular.module('myModule.ctrl', [])
.controller('MyCtrl', function($scope, oauth1Client) {
I get error: "Unknown provider: oauth1ClientProvider <- oauth1Client <-
ScheduleCtrl"

Thanks!


Reply to this email directly or view it on GitHub
#1.

@ppeczek
Copy link
Contributor Author

ppeczek commented Sep 3, 2015

Thanks for support, I also found the reason of error - in example you included angular-oauth1-client.min.js, but that file is missing in library. I needed to include angular-oauth1-client.js

@ppeczek
Copy link
Contributor Author

ppeczek commented Sep 4, 2015

ok, finally I configured it correctly. AngularJS manual is very poor, I learned how to fill config on some blog. Could you please complete your readme, so other angularjs beginners won't have problems? or let me pr?

Thank you very much for this awesome library. In spite of using other machines for oauth, sometimes you just want to do this on mobile app. Thanks to you it is possible in a very simple way.

Cheers!

@ppeczek
Copy link
Contributor Author

ppeczek commented Sep 4, 2015

You need to change 374 line to:
callbackUrl : oauthCallback

@zjleblanc
Copy link

Piotr,

On line 216, parameters should contain a value for the callbackUrl. Then
when you use the oauthParameters function the object will be extended to
have the values from parameters replace the null values you are looking at.
Does that make sense?

Also, most of the credit goes to Sean Fisher, but I will let him know!

Best,
Zach

Best,
Zachary LeBlanc
Notre Dame '16

On Fri, Sep 4, 2015 at 8:20 AM, Piotr Pęczek notifications@github.com
wrote:

One more thing: in line 66 you set callbackUrl to null, then in 83 you
check it's value. Therefore it is impossible to set callback.


Reply to this email directly or view it on GitHub
#1 (comment)
.

@ppeczek
Copy link
Contributor Author

ppeczek commented Sep 4, 2015

Sorry, right now I have no access to PC, but solution is in my last comment

@seanfisher
Copy link
Owner

@zjleblanc Thanks for being on top of this! Does this new commit look correct to you?

@ppeczek Thanks for using the library! We would love to see your pull request for the README or the code. It's a sad fact that READMEs are often a little out of date. Does 1efece5 fix your issues?

@seanfisher seanfisher reopened this Sep 5, 2015
@seanfisher
Copy link
Owner

Reopened until @zjleblanc and @ppeczek confirm.

@ppeczek
Copy link
Contributor Author

ppeczek commented Sep 7, 2015

No, dist/ is not working. I get unknown provider. For src/ everything's allright.

@shivaramanaiyer
Copy link

@seanfisher Thank you for this plugin. I have been able to open the authorization page and the user is able to login but, I do not understand what should be my callBackUrl while configuring the app.

I have tried http://localhost/app/login/callback & just /app/login/callback.

I couldn't find anywhere as to what should be the return url. Any information about it would be helpful.

@seanfisher
Copy link
Owner

@Shivaraman-iyer If I recall correctly the callback URL can be whatever full URL you like. The Javascript remembers what you use as the callback URL and listens for that specific callback URL on the in-app browser. When it sees that URL, it extracts the correct OAuth parameters out of the URL and closes the new window.

However, make sure to take into account any external constraints. For example, we were using this library to authenticate with Wordpress API (http://wp-api.org), which, contrary to the OAuth 1.0 Protocol RFC (http://tools.ietf.org/html/rfc5849), doesn't allow oob to be used as a callback URL. (There is currently an issue open for this at WP-API/OAuth1#28).

If you have tried http://localhost/app/login/callback and it still isn't working, I would suspect your issue is something else. Please feel free to open another issue if you can't resolve your problem.

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

4 participants