• Resolved ronwill06

    (@ronwill06)


    Has this question been answered?

    Hello,
    I’m trying to use this plugin with an app and with WP-REST-API. I followed the three steps (authorize, request_token, request_access), but the authorize just return a html page to login. Does there is a way to generate the auth_key in another way? Could I save the access_token permanently in my app?

    I’m also wondering how do I authenticate with just a username and password. I keep being redirected out of the app to sign in.

    https://ww.wp.xz.cn/plugins/oauth2-provider/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Justin Greer

    (@justingreerbbi)

    Hi @ronwill06,

    There are different grant types that you can use for difference reasons. What you are looking for, it something like user credentials.

    It looks like you are using the auth code (most common) grant type which is for browser based authentication. The HTML being returned is because it is trying to authenticate the user.

    Check out http://wp-oauth.com for more information but I am pretty certain you are going to need to use user credentials grant type for your ISO application.

    There is an alternative to purchasing my license (required to use anything other than auth code grant type), and that is https://github.com/justingreerbbi/application-passwords. It may hold what you are looking for.

    Thread Starter ronwill06

    (@ronwill06)

    Yes. I’m trying to use user credentials to verify a user has an account with our WordPress site. I see user credentials is the way to go. But do I use a POST method to verify the user or is it a GET request?

    How should I format the URL, parameters, and header to check if a user has an account?

    Thread Starter ronwill06

    (@ronwill06)

    I also don’t want to be redirected to a WordPress login webpage.

    Thread Starter ronwill06

    (@ronwill06)

    Currently, I am running a POST method with this endpoint”http://my.server.com/?oauth=token”
    with the client id and client secret as parameters, and the grant type is the password. My header is [“Authorization” : “basic”] When I do that I get back this header:

    NSHTTPURLResponse: 0x7fdb70ec0f00> { URL: http://my.servername.com/feed/?oauth=token } { status code: 200, headers {
    Connection = “Keep-Alive”;
    “Content-Type” = “application/rss+xml; charset=UTF-8”;
    Date = “Wed, 10 Feb 2016 03:36:08 GMT”;
    Etag = “\”432c60ef8667ecc6fe524b842eff1bd1\””;
    “Keep-Alive” = “timeout=5, max=100”;
    “Last-Modified” = “Sat, 06 Feb 2016 21:50:07 GMT”;
    Link = “<http://login.dogmadebate.com/wp-json/&gt;; rel=\”https://api.w.org/\””;
    Server = Apache;
    “Transfer-Encoding” = Identity

    I’m not getting back JSON with the access token. Where am I going wrong?

    Thread Starter ronwill06

    (@ronwill06)

    Never mind. I got it working. Thanks a bunch.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Login from iOS app’ is closed to new replies.