Get support for ramsey/oauth2-example
If you're new to LTH, please see our FAQ for more information on what it is we do.
Support Options
Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:
View Open IssuesTake a look to see if anyone else has experienced the same issue as you and if they managed to solve it.
Open an IssueMake sure to read any relevant guidelines for opening issues on this repo before posting a new issue.
Sponsor directlyCheck out the page and see if there are any options to sponsor this project or it's developers directly.
ramsey/oauth2-example
Mastering OAuth 2.0 Example Application
This is the full source code for the example application used in the "Mastering OAuth 2.0" talk for Day Camp 4 Developers: PHPAppSec.
This is a Laravel application that uses Instagram to illustrate OAuth 2.0 concepts.
Set Up
To run this application, open your favorite console application and run the following commands. If you haven't yet installed Composer, you'll need to install it first.
git clone https://github.com/ramsey/oauth2-example.git
cd oauth2-example/
git checkout dc4d
composer install
cp .env.example .env
touch database/database.sqlite
sed -i "s@DB_DATABASE=sqlitedb@DB_DATABASE="$PWD"/database/database.sqlite@" .env
php artisan key:generate
php artisan migrate
Go to https://instagram.com/ to create an Instagram account and then to https://instagram.com/developer/clients/register/ to sign up as a developer and register an Instagram client. One of your “Valid redirect URIs” must be the value:
http://localhost:8000/instagram
Edit .env
and modify the following values, according to the ones received from Instagram:
INSTAGRAM_CLIENT_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
INSTAGRAM_CLIENT_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Run the Application
After setting everything up, run the application:
php artisan serve
Then, in your web browser, go to http://localhost:8000/register and register for an account. Afterwards, go to http://localhost:8000/home and click the “Click here to authorize with Instagram” link. This will walk you through the Instagram OAuth 2.0 flow.
How It Works
Check out the "Mastering OAuth 2.0" chapter in Web Security 2016 from php[architect] magazine for more details on OAuth 2.0 and this example application. I also recommend reading Matthew Frost's Integrating Web Services with OAuth and PHP.
The most important files in this application to review as examples are app/Http/Controllers/HomeController.php
and resources/views/home.blade.php
.
Also, please refer to the following projects for more information on OAuth 2.0:
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated
p-e622a1a2