XF 2.3 OAuth Token use with the API

Joshb_

Member
The oauth token endpoint returns the user_id with an access_token thrown at the API. But can we get more information out of this response or will I have to hit the API with an API-Key to get the rest of the user's information? I've tried 7 ways to Sunday to hit the API with the access_token but clearly, I can't do that as defined in the REST API docs?

What I'm lost in, you can specify scopes in the application settings. But all that does is add the scopes to the token response. Which is useless if you can't hit the API with the access_token?
 
You can use bearer authentication (via a Authorization: Bearer <token> header).
 
Last edited:
You can use bearer authentication (via a Authentication: Bearer <token> header).
svUcWOt.png


Tried this with a few different endpoints.
 
Generally this has been an issue with the web server not passing the value through to PHP:

 
Generally this has been an issue with the web server not passing the value through to PHP:

Yep. That was it. Didn't work at first but realized I had your Authentication header still in there. Authorization*

Great stuff you guys are doing. As always. Thanks a bunch.
 
Does this mean you can hit the API endpoints as a specific user without having to create individual keys and scope set for each person?
 
Thanks, it's something I've been wondering about but wasn't sure how the pieces connect. I had previously assumed each user would require their own API key specific to them and it's up to a dev to automate those.

I'm aware of the 2.2 API docs, but is Oauth+API integration covered somewhere too?
 
Thanks, it's something I've been wondering about but wasn't sure how the pieces connect. I had previously assumed each user would require their own API key specific to them and it's up to a dev to automate those.

I'm aware of the 2.2 API docs, but is Oauth+API integration covered somewhere too?

It's very vague since it operates as an ordinary Oauth application. It has the token itself and a refresh token you can hit the authorize endpoint to refresh your auth token.
 

It's very vague since it operates as an ordinary Oauth application. It has the token itself and a refresh token you can hit the authorize endpoint to refresh your auth token.
Appreciate it, hadn't seen this "Have you seen" entry at all. I wish there was more comprehensive Oauth + API docs with examples provided together.

It's a solid selling point for Xenforo and I'd bet many people have hardly heard about it, especially the Oauth integration.
 
Back
Top Bottom