Code Monkey home page Code Monkey logo

sample-oauth2-client's Issues

Example seems not to work here with me

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

The requested URL /callback was not found on this server.

Hello,

I ran the sample github.php app and get the following error:

image

Is there something we need to configure in the github.php file in order to account for the /callback

Environment:
Ubuntu 16.04 server with LAMP stack, configured with self-signed cert.

Thanks

SERVER_NAME vs HTTP_HOST in google.php

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

Github login example not working for me

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.