Discuss Scratch

scratchieguy12345678
Scratcher
500+ posts

Goboauth

Goboauth is an authentication system I've been working on for the past week. I don't know why I decided to make a new authentication system, I mean, Fluffyscratch is already fine. I just figured it would be a good project for me to work on. I decided to make a new topic just to show off the system. It's not complete yet, but I am going to post updates about it here.

Also, I probably would not recommend using this because Fluffyscratch is better in every way.

Replit: https://replit.com/@linearlemur/goboauth#index.html

Update 1: Frontend complete

I should probably use more CSS… Nah, that'll have to wait until the next version.

Last edited by scratchieguy12345678 (May 24, 2021 13:08:22)

Steve0Greatness
Scratcher
1000+ posts

Goboauth

Looks cool! Hope the project goes well from here.
scratchieguy12345678
Scratcher
500+ posts

Goboauth

Steve0Greatness wrote:

Looks cool! Hope the project goes well from here.

Thanks!
kccuber
Scratcher
1000+ posts

Goboauth

if you need, i can help with the CSS.
scratchieguy12345678
Scratcher
500+ posts

Goboauth

kccuber wrote:

if you need, i can help with the CSS.

Sure, you can help!
airplanedodge
Scratcher
1000+ posts

Goboauth

scratchieguy12345678 wrote:

kccuber wrote:

if you need, i can help with the CSS.

Sure, you can help!
Ok! (sorry, i'm an alt account of @kccuber, i should really add that to my siggy tbh)
scratchieguy12345678
Scratcher
500+ posts

Goboauth

REDACTED

Last edited by scratchieguy12345678 (May 21, 2021 18:20:26)

9gr
Scratcher
1000+ posts

Goboauth

i already finished my google-styled auth called Greenauth. I don't think my one is poggers so i didn't bother making a topic about it because there are too many new auth systems coming out lately. I may help with this though
scratchieguy12345678
Scratcher
500+ posts

Goboauth

9gr wrote:

i already finished my google-styled auth called Greenauth. I don't think my one is poggers so i didn't bother making a topic about it because there are too many new auth systems coming out lately. I may help with this though

I know that there's a billion authentication systems out there, I just created this as a way for myself to learn more about HTML and Javascript. I made a topic about it just to show it off.
9gr
Scratcher
1000+ posts

Goboauth

scratchieguy12345678 wrote:

9gr wrote:

snip

I know that there's a billion authentication systems out there, I just created this as a way for myself to learn more about HTML and Javascript. I made a topic about it just to show it off.
okay
is this a nodejs repl?
scratchieguy12345678
Scratcher
500+ posts

Goboauth

9gr wrote:

scratchieguy12345678 wrote:

9gr wrote:

snip

I know that there's a billion authentication systems out there, I just created this as a way for myself to learn more about HTML and Javascript. I made a topic about it just to show it off.
okay
is this a nodejs repl?

Yes, I'm using Nodejs for the backend.
scratchieguy12345678
Scratcher
500+ posts

Goboauth

I should probably detail how the backend is going to work:

1. The website generates a random, 10 digit long code
2. The website redirects the user to https://goboauth.linearlemur.repl.co/index.html?code=x, x being the code generated
3. The user clicks a button that brings them to the Scratch project
4. The user enters their code into the project
5. The user goes back to Goboauth and clicks “I have finished”
6. Goboauth checks https://mv-ezproxy-com.ezproxyberklee.flo.org/logs?projectid=532947328&limit=2&offset=0
7. The keys “verified?” and “username” in a JSON file named “verified?&username” are set to “true” and the username of the user if they're verified
8. The website makes a GET request to “verified?&username” and gets the username of the user if they're verified

Last edited by scratchieguy12345678 (May 24, 2021 13:45:09)

kccuber
Scratcher
1000+ posts

Goboauth

scratchieguy12345678 wrote:

airplanedodge wrote:

scratchieguy12345678 wrote:

kccuber wrote:

if you need, i can help with the CSS.

Sure, you can help!
Ok! (sorry, i'm an alt account of @kccuber, i should really add that to my siggy tbh)

Here's the REPL: -removed, please don't share replit collab links-
no thanks, i'll fork the Goboauth repl or something instead of using that link. Also, remove it please.
scratchieguy12345678
Scratcher
500+ posts

Goboauth

kccuber wrote:

scratchieguy12345678 wrote:

airplanedodge wrote:

scratchieguy12345678 wrote:

kccuber wrote:

if you need, i can help with the CSS.

Sure, you can help!
Ok! (sorry, i'm an alt account of @kccuber, i should really add that to my siggy tbh)

Here's the REPL: -removed, please don't share replit collab links-
no thanks, i'll fork the Goboauth repl or something instead of using that link. Also, remove it please.

Sorry, I didn't know that.

Last edited by scratchieguy12345678 (May 21, 2021 18:16:38)

scratchieguy12345678
Scratcher
500+ posts

Goboauth

bump
gdpr5b78aa4361827f5c2a08d700
Scratcher
1000+ posts

Goboauth

because we need another one of these.

anyway pretty cool. i have my own auth system for magnifier (furrycat auth, The Most Blatant FluffyScratch Knockoff Since OAuth™), which i might make public docs for at somepoint, but neat, although why not comments? comment auth=new scratchers.

pls make it look nice.
scratchieguy12345678
Scratcher
500+ posts

Goboauth

potatophant wrote:

because we need another one of these.

anyway pretty cool. i have my own auth system for magnifier (furrycat auth, The Most Blatant FluffyScratch Knockoff Since OAuth™), which i might make public docs for at somepoint, but neat, although why not comments? comment auth=new scratchers.

pls make it look nice.

Thanks! I probably should've used comment auth, it's just that cloud auth was the first thing that came to mind. Also, I'm working on the making it look nice thing, I promise.
gdpr5b78aa4361827f5c2a08d700
Scratcher
1000+ posts

Goboauth

scratchieguy12345678 wrote:

potatophant wrote:

because we need another one of these.

anyway pretty cool. i have my own auth system for magnifier (furrycat auth, The Most Blatant FluffyScratch Knockoff Since OAuth™), which i might make public docs for at somepoint, but neat, although why not comments? comment auth=new scratchers.

pls make it look nice.

Thanks! I probably should've used comment auth, it's just that cloud auth was the first thing that came to mind. Also, I'm working on the making it look nice thing, I promise.
very epic poggers

also i doubt anyone cares but
using HtmlAgilityPack;
using Magnifier.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace Magnifier.Models
{
    [Route("api/[controller]")]
    [ApiController]
    public class AuthController : ControllerBase
    {
        private readonly JwtAuthService jwtAuthService;
        private readonly AuthCodeService authCodeService;
        private readonly UserService userService;
        private Uri authProject = new Uri("https://mv-ezproxy-com.ezproxyberklee.flo.org/users/furrycat-auth/projects/534514916/comments");
        public AuthController(JwtAuthService _jwtAuthService, AuthCodeService _authCodeService, UserService _userService)
        {
            jwtAuthService = _jwtAuthService;
            authCodeService = _authCodeService;
            userService = _userService;
        }
        [HttpGet("code")]
        public ActionResult GenerateCode()
        {
            string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
            int len = 36;
            Random rnd = new Random();
            StringBuilder b = new StringBuilder(len);
            for (int i = 0; i < len; i++)
            {
                b.Append(chars[rnd.Next(chars.Length)]);
            }
            string result = b.ToString();
            authCodeService.Create(new AuthCode(result));
            return Ok(result);
        }
        [HttpGet("token")]
        public async Task<ActionResult> GetTokenAsync(string code)
        {
            foreach (AuthCode authCode in authCodeService.Get())
            {
                if (authCode.code == code && authCode.hasBeenUsed == false)
                {
                    HttpClient client = new HttpClient();
                    var response = await client.GetAsync(authProject);
                    var data = await response.Content.ReadAsStringAsync();
                    dynamic apiComments = JsonConvert.DeserializeObject<List<ScratchComment>>(data);
                    List<ScratchComment> comments = new List<ScratchComment>();
                    foreach (ScratchComment jsonComment in apiComments)
                    {
                        comments.Add(new ScratchComment(jsonComment.id, jsonComment.content, jsonComment.author, jsonComment.datetime_created));
                    }
                    string token = "";
                    foreach (ScratchComment comment in comments)
                    {
                        if (comment.content == code)
                        {
                            authCodeService.Update(code, new AuthCode(code, true));
                            if (userService.Get(comment.author.username) == null)
                            {
                                userService.Create(new User(comment.author.username, comment.author, comment.author.username == "potatophant"));
                            }
                            token = jwtAuthService.GenerateJwt(code, comment.author.username, comment.author.username == "potatophant");
                        }
                    }
                    if (token == "")
                    {
                        return BadRequest();
                    }
                    else
                    {
                        return Ok(token);
                    }
                }
            }
            return Unauthorized();
        }
        [HttpGet("user")]
        [Authorize]
        public ActionResult GetUser()
        {
            User user = userService.Get(HttpContext.User.Claims.ToList().Find(claim => claim.Type == "username").Value);
            if (user != null)
            {
                return Ok(JsonConvert.SerializeObject(user));
            }
            return NotFound();
        }
    }
}

and yes im aware that code is a mess

Powered by DjangoBB