Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

"You do not have permission" at "api/users/me" and Fatal error: Call to undefined method #133

Closed
suj87 opened this issue Sep 15, 2020 · 6 comments
Assignees
Labels

Comments

@suj87
Copy link

suj87 commented Sep 15, 2020

When my OAuth flow points to api/users/me with Bearer token added to authorization header - I'm receiving the error You do not have permission.

If I manually add oauth_token=token as query string parameter (for testing), the request seems to work but receive the error: Fatal error: Call to undefined method Xfrocks\Api\XF\ApiOnly\Template\Templater::func() in \htdocs\xf2.1\src\addons\Xfrocks\Api\XF\Transform\User.php on line 160

Any ideas?

Test setup is: WAMP 2.4 (Apache 2.4.4, PHP 5.6.40). XF version 2.1.1. BDAPI version 2.0.1 Beta 4.

@daohoangson
Copy link
Contributor

That's weird... Are you still having this problem today?

@daohoangson daohoangson self-assigned this Sep 18, 2020
@suj87
Copy link
Author

suj87 commented Sep 18, 2020

That's weird... Are you still having this problem today?

Yes unfortunately. I've been waiting for your reply as I don't know where to start with debugging, haha. I tried uninstalling and reinstalling the add-on a couple of times but same issue. (This is on a completely fresh install of XF).

The exact same code I use against XF 1.5 and BDApi works perfectly.

Are you able to reproduce the issue?

@daohoangson
Copy link
Contributor

Oh, you were running XenForo 2.1.1 not 2.1.10... Yes, that's expected. You have to update to at least 2.1.4 for this.

daohoangson added a commit that referenced this issue Sep 20, 2020
@suj87
Copy link
Author

suj87 commented Sep 22, 2020

Upgrading to 2.1.4 correctly shows user info if oauth_token is passed in URL - so thanks for that :)

However, if oauth token is added to authorization header, the same 403 Forbidden error occurs e.g.:

RequestMessage	{Method: GET, RequestUri: 'http://192.168.0.20:81/xf2.1/bdapi/users/me', Version: 1.1, Content: <null>, Headers:
{
  Accept: application/json
  Authorization: Bearer 7mRfcYc2PwEpci2fjCpPFz6q5jh6HA31puV2ANcD
  User-Agent: Microsoft
  User-Agent: ASP.NET
  User-Agent: Core
  User-Agent: OAuth
  User-Agent: handler
  Request-Id: |6797f6c7-458833252b1cc5b2.
}}

Does this version not support grabbing token from headers?

Thanks

@suj87
Copy link
Author

suj87 commented Sep 29, 2020

Ahh, this is due to Apache stripping headers for some reason, as mentioned here: #60 (comment)

@suj87 suj87 closed this as completed Sep 29, 2020
@daohoangson
Copy link
Contributor

Ah, Apache. I recall hearing about something similar but couldn't find that issue. Glad you sorted it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants