Skip to content
New issue

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

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

Already on GitHub? # to your account

Authorization Failure #1

Closed
bradmartin opened this issue Jun 13, 2015 · 8 comments
Closed

Authorization Failure #1

bradmartin opened this issue Jun 13, 2015 · 8 comments
Labels

Comments

@bradmartin
Copy link

I followed this code and I can't determine why the authorization is failing.
twitauth

I have the correct keys in place and running on an actual device. Is there anything you might have left out of the docs or config?

@drrasic
Copy link
Owner

drrasic commented Jun 13, 2015

Eveything is there, i have tested it just by pulling this rep, switching the keys and running, and it worked perfectly... I'll try to recreate that error tonight and possibly help.

@bradmartin
Copy link
Author

I'm trying to diagnose it, I've debugged the factory calls and everything goes through, the keys are in place. I'll check to make sure they're correct tonight. I'll pull this repo now and use my keys and see if my keys work correctly. Thanks. This solution is one of the simplest I've found with Twitter 1.1 API.

@bradmartin
Copy link
Author

ionictwit

I downloaded the repo, put my keys in the services variables and built the .apk. Installed and that's the errors when using chrome://inspect in the console. I'll work on it for a little bit longer and see what I can find. I'm trying to pause it to debug why the token isn't available in the call. I'll move the call to a button click and see if I can find something useful to you.

@bradmartin
Copy link
Author

Somewhere authorization and access_token are null. Stepping through it now to see if I can wrap my head around the Oauth process they have.

@bradmartin
Copy link
Author

I've been testing it with POSTMAN to see what's off. I think the 'grant_type=client_credentials' is not being sent in the request correctly. When testing the request in POSTMAN, I had to select the 'x-www-form-urlencoded' option for the 'grant_type=client_credentials' then the token is returned. If I try passing as 'form-data' it returns code 170 from Twitter api : 'Missing required parameter: 'grant_type'

@drrasic
Copy link
Owner

drrasic commented Jun 14, 2015

Yeah, thats why there is 'application/x-www-form-urlencoded' in post method on line 138. It doesn't work without that.

I did some tests to try and produce the exact same output but was unable... so to clear some possibilites i have made a test acc on twitter that is working for me, so ill email you the keys to test out. Im interested in how it goes...

@drrasic
Copy link
Owner

drrasic commented Jun 14, 2015

Oh man it's the f*****g new cordova version :), i forgot about this.... and i had and older version installed on this system...
take a look at this
http://docs.ionic.io/v1.0/docs/cordova-whitelist

For quick test u need to
cordova plugin add https://github.com/apache/cordova-plugin-whitelist

and this meta tag to index.html
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

Hope it helps.

@bradmartin
Copy link
Author

haha I have the plugin already, I just don't have the meta tag. I'll add it and give it a try later on. Thanks!

@drrasic drrasic added the bug label Jun 14, 2015
@drrasic drrasic closed this as completed Jun 14, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants