Sample OAuth 2.0 clients using the GitHub and Google APIs
Read more info in the book OAuth 2.0 Simplified
Sample OAuth2 client using the GitHub API
Home Page: https://www.oauth.com
License: Apache License 2.0
Sample OAuth 2.0 clients using the GitHub and Google APIs
Read more info in the book OAuth 2.0 Simplified
First off, I tried the example on my local machine, but when clicking the login link, nothing would happen. I had a feeling this was because running a PHP server locally doesn't allow for HTTPS.
So then I tried doing this on Replit and I changed the application and callback URL accordingly, e.g. $REPL_URL/callback. However, now when I click the log in link, I just keep getting this error:
GET /callback?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.&error_uri=https%3A%2F%2Fdocs.github.com%2Fapps%2Fmanaging-oauth-apps%2Ftroubleshooting-authorization-request-errors%2F%23redirect-uri-mismatch&state=db6bcd3385400582f5b74a074187c22
Not sure what to check here, any ideas?
Hi Aaron
I just started to read your book "Oauth2 simplified", but now im struggling already with the first example with GitHub. When I point my browser to localhost:8000 I get the login page as expected. Click on "Log In" redirects me to GitHub-Login. Here's my first issue: in the console, I get a warning "Cross-Origin Read Blocking (CORB) blocked cross-origin response https://api.github.com/_private/browser/stats with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details". Though, it seems to work so far. After logging in, I'm being redirected back to localhost:8000/index.php, but still get the "Not logged in" Text. When I log the access token to the console, its empty. Where's the mistake? I work on Windows 10.
Regards,
Stefan
I am using an NGINX web server with a regular expression to match multiple host names, and the SERVER_NAME returned is the regular expression, not the actual host name requested/used. This caused an interesting (to me) issue because Google of course did not like the regular expression as the redirect URI.
I fixed this for my site by changing this
$baseURL = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
to this
$baseURL = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
I am not sure if this is a universally wholesome change or if it introduces problems for a different configuration. Just sharing in case it is helpful to someone else.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.