Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am building a website for a class the following is my code for google sign in. The follwoing code is for the index page

I am building a website for a class the following is my code for google sign in.

image text in transcribed

image text in transcribed

The follwoing code is for the index page where the user first visits. Once they login with google they are redirected to the homepage.

image text in transcribed

image text in transcribed

How can I make it so the homepage is not accesible to anybody that is not signed in. Currently if i type the url in the web browser i still have access to the home page. What code can I add to the home page??

Home page

image text in transcribed

K?php class GoogleAuth protected $db; protected $client; public function construct(DB $db null, Google Client $googleClient null) $this->db $db; $this- client $googleClient. ($this->client $this- client->setclientid('361982001136-ghjdqd7kb74h1vaii.apps.googleusercontent.com'); $this- client- setclientsecret('7Pgq6b164GR7y'); $this- client->setRedirectUni('https://the-coyote-xchange-emmanuelgi13546904.codeanyapp.com/index.php'); $this- client->se tScopes( email') public function isLoggedIn() return isset SESSION 'access token'D public function getAuthurl() return $this->client- createAuthurl public function checkRedirectCode() if(isset GETC' code'])) $this- client- authenticate($ GETC'code' J); $this- set Token ($this client->getAccessToken()) $this-> storeUser($this->getPayload()) return true; return false

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago