Make Authentication Easy with ‘Sign in with CSE JnU’

Building a project for your department and worried about authentication? Making sure only real students can log in can be tough. But with ‘Sign in with CSE JnU’, you don’t have to worry anymore!

This feature allows students to log in using their CSE JnU accounts. It’s simple, automatic, and updates their data whenever they update their profile on the main site. The best part? No need to write extra code to check if they’re valid students. Just follow these two easy steps:


Step 1: Redirect Users to the Auth Server

When a user wants to sign in, send them to the Auth server. Include a callback URL, so the Auth server knows where to send them back after login. For example:

http://auth.itrrc.com/?callback=https://yoursite.com/success.html

If the user enters the correct username and password, they’ll be redirected back to your site with a token attached to the URL, like this:

https://yoursite.com/success.html?token=ey....xyz

Step 2: Verify the Token on Your Backend

After the user lands back on your site, grab the token from the URL. Now, verify the token by sending it to the Auth server:

http://auth.itrrc.com/verify?token=ey....xyz

If the token is valid, you’ll get a response like this:

{
"valid": true,
"payload": {
"name": "MT ASFI",
"email": "asfi@gmail.com",
"meta": {
"role": "student",
"student_id": "B2003051234",
"batch": "1",
"cr": false,
"graduated": false,
"job_description": "Software Engineer",
"blood_type": "A+",
"birthday": "1/12",
"gender": "Male",
"linkedin": "https://linkedin.com/",
"photo": "https://blog.com/profile_photo.jpg"
},
"iat": 1737215096,
"exp": 1737218696
}
}

If the token is invalid, you’ll get a response like this:

{
"valid": false,
"message": "Invalid signature"
}

Why Use ‘Sign in with CSE JnU’?

  • No Extra Work: You don’t need to write code to verify if users are real students.
  • Always Up-to-Date: If a student updates their main profile, the changes sync automatically.
  • Super Simple: Just two easy steps and you’re done!

If you’re wondering how to get started, I’ve got you covered! I’ve created a demo project on GitHub using Express.js to show exactly how to integrate ‘Sign in with CSE JnU’. You can check it out, explore the code, and see how simple it is to implement. 🚀

Open the demo project on GitHub

Now you can make your project secure without breaking a sweat. Add ‘Sign in with CSE JnU’ and focus on building something amazing! 🚀

Ad will appear here

This is a dummy ad for testing purposes

Related articles

November 2024 Update: New Features and Improvements

Profile & Registration Enhancements: Graduated: Mark "Yes" if you're an...

Code Samurai 24 Experience: CSE JnU Secured 5th Place

My team "Quantum Guys" finished 5th in Code Samurai...

পদার্থবিজ্ঞানের নোবেল কম্পিউটার সায়েন্সে?

২০২৪ সালের পদার্থবিজ্ঞানে নোবেল পুরস্কার পেয়েছেন দুইজন অসাধারণ বিজ্ঞানী—...

Policy-Based Data Structures (PBDS) in Competitive Programming

In competitive programming, efficiency and correctness are paramount, and...

1 COMMENT