Resolved Authenticating a user using User credentials (username / password)

Discussion in '[bd] API' started by SeToY, Apr 6, 2017.

  1. SeToY

    SeToY New Member

    Hello there,

    I'm trying to create an application that uses the same credentials as our users use in our forums for signing in.

    Is there a sample request on how to authenticate a user using their board credentials? I haven't found anything in the documentation regarding that, unfortunately.

    What I'm trying to do is:
    - The user is logging in to our application using their board credentials
    - I then fetch basic information from the users profile (such as custom fields and the e-mail address)
    - I fetch a few posts to display within the application

    Could anyone guide me to the right place in the documentation or the request flows?

    Thank you!
     
    Tags:
  2. xfrocks

    xfrocks XenForo rocks! Staff Member

    It's basic password grant type, see here https://aaronparecki.com/oauth-2-simplified/#others

    OAuth 2 Simplified

    This post describes OAuth 2.0 in a simplified format to help developers and service providers implement the protocol.
    aaronparecki.com


    For example, here is a request against xfrocks.com:

    Code:
    > curl -XPOST 'https://xfrocks.com/api/index.php?oauth/token' -d 'grant_type=password&client_id=xxx&client_secret=xxx&username=xxx&password=xxx'
    {"access_token":"xxx","expires_in":"3600","token_type":"Bearer","scope":"read post usercp conversate admincp","refresh_token":"xxx","user_id":123,"refresh_token_expires_in":1209600}
     
  3. SeToY

    SeToY New Member

    Thanks, this has worked!
     
    xfrocks likes this.
Loading...