Undefined index: my_accessToken


this is my code

	$accessToken = $_SESSION['my_accessToken'];

and this is the error


set the token first before trying to use it.


How would I do that? I am trying to connect it with github API, OAuth

Access token is unique each time right? All I have is public and secret IDs.

Here is full code from the index.php

	$accessToken = $_SESSION['my_accessToken'];

	if ($accessToken != "") {
		echo '<p>loggedin</p>';
	} else {
		echo '<p><a href ="https://github.com/login/oauth/authorize?client_id=70ad6e323f9e5dadb65c">signin</a></p>';

This then goes to a callback(callback.php) once the user login via github

Sorry but this is the first time for me trying out OAuth


You are trying to use the value without checking to see if it exists.

1 Like