mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 20:55:57 +03:00
[GH-ISSUE #306] WordPress OAuth1 returns "No OAuth parameters supplied" #185
Labels
No labels
bug
cocoapod
duplicate
enhancement
feature-request
help wanted
help wanted
invalid
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/OAuthSwift#185
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @phamdacloc on GitHub (Nov 5, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/306
Description:
I'm running OAuth1 against wordpress but receiving 400 error code: "No OAuth parameters supplied"
Here is the test functions:
OAuth Provider (WordPress):
WP REST API - OAuth 1.0a Server
OAuth Version:
OS (Please fill the version) :
Installation method:
Library version:
Xcode version:
8.0 (Swift 3.0)
8.0 (Swift 2.3)
7.3.1
other: (8.1)
objective c
@phimage commented on GitHub (Nov 5, 2016):
did you try with other API (python, php?)
are your wordpress well setup for oauth
try in a .htaccess file
@phamdacloc commented on GitHub (Nov 5, 2016):
No I haven't tried with other languages other than Swift. However, I did tried with Postman and it worked. On WordPress, I installed
WP REST APIandWP REST API - OAuth 1.0a Serverplugins.@phamdacloc commented on GitHub (Nov 5, 2016):
How exactly do I edit .htaccess file? Here is the old .htaccess
With your suggestion, am I suppose to add it to the end like below?
@phimage commented on GitHub (Nov 5, 2016):
332750b9f6just tested now into the demo appno problem...
using master head version (now oauthSwift >1.1.0)
after creating the "Application" into wordpress admin
@phamdacloc commented on GitHub (Nov 6, 2016):
I tried the latest OAuthSwift tip 1.1.0 on my Wordpress site. The current demo project has both
Allow Arbitrary LoadsandAllow Arbitrary Loads in Web Contentturned on underApp Transport Security Settings. With those, I still received:App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.However, when I added
NSExceptionAllowsInsecureHTTPLoadsunder theException Domainsthen the warning goes away. But i'm still struck with OAuthSwiftError error -11What does -11 exception means in this case as I'm not able to get a success
oauthswift.authorize()call.@phimage commented on GitHub (Nov 6, 2016):
please read code to know -11 meaning
OAuthSwiftError => request error, with inside a cause NSError
Did you see your wordpress into webview to login? (please when you describe a problem, describe all the scenario...) have you access to it from simulator
try osx demo
@phamdacloc commented on GitHub (Nov 6, 2016):
No I did not see any internal webview that would display the wordpress login. As described above, the code took the failure path on function
authorize(withCallbackURL callbackURL: URL, success: @escaping TokenSuccessHandler, failure: FailureHandler?) -> OAuthSwiftRequestHandle?I will try the osx demo.
@phamdacloc commented on GitHub (Nov 6, 2016):
osx demo has the same request error: (OAuthSwiftError error -11.)
Do you mind share the .htaccess file you used that gave you a successful run?
Thanks
@phimage commented on GitHub (Nov 6, 2016):
no .htaccess, it was a sugestion due to google result
just a fresh wordpress installation
try to update your wordpress and plugins...
I will stop to help without more information. I cannot reproduce your issue
@phamdacloc commented on GitHub (Nov 6, 2016):
My site is a fresh install too. I've also installed the two plugins:
WordPress REST API (Version 2) <-- 2.0-beta15
WordPress REST API - OAuth 1.0a Server <-- 0.3.0
This still left me with OAuthSwiftError error -11.
Is anyone other than phimage had a successful authentication with their wordpress?
@phamdacloc commented on GitHub (Nov 7, 2016):
Looking through OAuthSwift code, particularly
OAuthSwiftClient.post()function, I noticed theOAuthSwift.Headersandbodyarguments werenil. I can't find anywhere in the code which actually setsOAuthSwift.Headers. Is that expected when you're trying to post a token request operation? If I understand correctly,OAuthSwiftClient.post()is only sending theoauth_callbackbut not the consumer key nor consumer secret.One other note, in Postman, I have to tick
Add empty params to signaturefor the request to be successful. Is that something required in OAuthSwift as well?Thanks
@phimage commented on GitHub (Nov 7, 2016):
If your are successfully logged , post request send the token and token secret (not consumer key and secret)
post functions have parameters, there is plenty of example into demo app
and it's work like other API.
You can fill body yourself or
parameterswith a dictionary , and parameters will be converted into an "application/x-www-form-urlencoded" body@phamdacloc commented on GitHub (Nov 7, 2016):
I never had a successful logged on, this is where I'm stuck at. OAuth1 protocol requires three steps:
OAuthSwift execute the first step by sending a
POSTrequest to/oauth1/requestendpoint. When sending thePOSTrequest, the following info should be sent:This is where i'm lost because when I set the breakpoint at
OAuthSwiftClient.post()for the/oauth1/requestendpoint, the only data is see isoath_callbackwhileOAuthSwift.Headersandbodywere both nil.@phimage commented on GitHub (Nov 7, 2016):
you try to understand oauth1 to debug?
all flow is done in https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/OAuth1Swift.swift
there is
this is where a view is presented to user to login and authorize app
put a breakpoint here
the signing process is done in request
https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/OAuthSwiftHTTPRequest.swift
@phamdacloc commented on GitHub (Nov 10, 2016):
Could the
OAuthSwiftError error -11be related to my website being http and not https?Also, I noticed when performing
POSTrequest via Postman for http://example.us/oauth/request endpoint, empty parameter must be added to the signature for it to work. If that option is left blank, I'd getOAuth signature does not matcherror. I'm wondering if that is related to my problem.Thanks.
@phimage commented on GitHub (Nov 10, 2016):
please refer -11 as
requestError. This error could be many things, you have an underlying error for that...@phamdacloc commented on GitHub (Nov 10, 2016):
Eric, the Wordpress website that you had a success request before is http or https?
@phimage commented on GitHub (Nov 10, 2016):
see demo app : http://localhost/wordpress
@phamdacloc commented on GitHub (Nov 10, 2016):
Yep i saw the demo app. I wasn't sure if you entered in a different url in your services.plist file. So seems like we're having a totally different environment. Mine is on production site and yours is on a localhost development.
@kangho99 commented on GitHub (Dec 2, 2016):
I got into the same situation where the server returns "No OAuth parameters supplied".
If you made the same mistake I made, this should solve it:
Make sure the "callback" url in your wordpress application settings (where you get the key / secret from) and the oauth1swift.authorize() -> withCallbackURL parameter matches.
@phimage commented on GitHub (Dec 2, 2016):
thanks @kangho99 for the advice
I will close (no activity since 20 day)
@torrelasley commented on GitHub (Jan 6, 2017):
kangho99's answer was exactly my problem as well. You will get an OAuthSwiftError -11 if the "withCallbackURL" parameter does not match EXACTLY what is in WordPress under Users -> Applications -> App -> Callback
@richard-giantrobot commented on GitHub (Jan 9, 2017):
I was having the same issue on Wordpress 4.7 with WP REST API OAuth server 1.0a
Solved it by adding this line before calling the authorize function:
oauthswift.client.paramsLocation = .requestURIQueryWhere oauthswift is a OAuth1Swift instance.
Hope this helps if somebody is having this issue.