php-oath | PHP HOTP/TOTP Implementation | Authentication library
kandi X-RAY | php-oath Summary
kandi X-RAY | php-oath Summary
php-oath
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Convert counter to binary string .
- Truncates a string to dynamic truncate
- Get the OAuth URI
- Generate an OTP OTP .
- Validate input .
- Get the counter value .
- Sets the epoch
- Get the epoch .
- Sets the time step
- Get time step
php-oath Key Features
php-oath Examples and Code Snippets
Community Discussions
Trending Discussions on php-oath
QUESTION
I'll try to sketch our situation:
- We have a Wordpress website that needs to connect to an Oath2 API
- I have little experience yet using API's and PHP
- We are using a PHP-Oath2 library, which can be found here: https://github.com/adoy/PHP-OAuth2/tree/master/src/OAuth2
The method from the libary where we're stuck is executeRequest. This method can be found on line 404 (oh the irony) of https://github.com/adoy/PHP-OAuth2/blob/master/src/OAuth2/Client.php
Now, like I said, I've little experience in PHP so my way of debugging is just echo'ing the status of variables at given points in the script. Amateuristic as this may be, I could at least verify that the url and parameters are correct. I could print the complete URL (dummy parameter values ofc):
Mind the following parameters used:
code
,redirect_uri
,grant_typen
client_id
andclient_Secret
.
When you execute this request, you'll get a JSON error message. Which is normal, as I cannot give you our client_id and client_secret:
...ANSWER
Answered 2018-Aug-14 at 18:09There is a difference between your testing in browser and the actual code: In the browser, you pass the variables as GET parameters, while in your code you are sending a POST body.
To debug such issues I often find it easier to use CLI curl
before going to PHP. When I send the request like this (mind the Content-Type
header) I managed to get a positive result:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install php-oath
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page