Skip to content

Instantly share code, notes, and snippets.

@damaneice
Last active January 29, 2024 21:03
Show Gist options
  • Save damaneice/a2aa8b19e698876ed37626a6b7b861ff to your computer and use it in GitHub Desktop.
Save damaneice/a2aa8b19e698876ed37626a6b7b861ff to your computer and use it in GitHub Desktop.
How to deliver GitHub Education benefits to your students

Hello! This documentation has been deprecated - you can find the updated documentation at https://gist.github.com/jen-k/73e5dae57526ecf73d8475e2f59a3f9a

Deprecated documentation

How to deliver GitHub Education benefits to your students

Students at your school can quickly claim their GitHub Education benefits by visiting a unique web address. By visiting that address, GitHub will verify the student's academic status with your school and instantly deliver their benefits to them.

Your school can create a unique web address for each student by including three things in it:

  1. school_id: Your school’s unique identifier, provided by GitHub.

  2. student_id: The individual student’s unique identifier, defined by your school.

  3. signature: A code used to authenticate the message, produced by your school using an algorithm (instructions below).

Used together, your school can deliver each student a unique web address that looks something like this:

https://education.github.com/student/verify?school_id=1&student_id=1&signature=b89099fdb8a24b0e2ef8ab0de893bb9408392cbf84e8fb9186adb84a920c536c

How to produce each student’s ‘signature’

The algorithm you’ll use to create each student’s signature requires the aforementioned school_id and student_id, as well as an additional GitHub-provided secret_key.

The algorithm requires that each of these values be passed as strings -- not numerals.

Here, for example, is how you can then produce a student’s signature using Ruby:

signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), secret_key, school_id + student_id)

What students should expect

When a student receives their unique web address from your school, they can visit that address in any web browser. If they are already signed into GitHub on that browser, they’ll see a GitHub Education web page confirming that they’ve been verified.

screen shot 2018-07-09 at 10 11 02 am

If they’re not yet signed in, the student will simply be asked to sign in before seeing the confirmation web page.

@jen-k
Copy link

jen-k commented Apr 21, 2020

Hey @pensierinmusica,

@damaneice is no longer on this project, but I'll ping another engineer on the team to see if I can determine the invalid characters. We're short-staffed at the moment, but we'll get this updated! Thanks!

@karlhorky
Copy link

@jen-k Re: validation, in case the team would want to co-maintain / take over the URL generator repo I created (and add the validation rules there in Ruby + JavaScript + Shell code), here is a link:

https://github.com/upleveled/github-education-generate-student-url

@pensierinmusica
Copy link

pensierinmusica commented May 3, 2020

@jen-k awesome, thx! 🙂

@romaindelamare
Copy link

romaindelamare commented Jun 22, 2020

If someone need in C#

var userId = ...;
var schoolId = ...;
var secret = ...;
var githubUrl = "https://education.github.com/student/verify?school_id={0}&student_id={1}&signature={2}";

byte[] keyByte = new ASCIIEncoding().GetBytes(secret);
byte[] messageBytes = new ASCIIEncoding().GetBytes(string.Concat(schoolId, userId));
byte[] hashmessage = new HMACSHA256(keyByte).ComputeHash(messageBytes);

StringBuilder hex = new StringBuilder(hashmessage.Length * 2);
foreach (byte b in hashmessage)
{
    hex.AppendFormat("{0:x2}", b);
}

var signature =  hex.ToString();
var url = string.Format(githubUrl, schoolId, userId, signature);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment