bundit / kord

Spotify, Soundcloud, and YouTube all in one website!
https://www.kord.app
MIT License
646 stars 73 forks source link

.env variable examples in README #56

Closed Otju closed 3 years ago

Otju commented 3 years ago

Everything else in the README is clear, and I can get the app running on my on computer just fine, but I can't seem to get the login working. I can't figure out what I'm supposed to set these four variables in the .env file to. Nothing happens after I press "Allow" on in the Youtube/Spotify login window.

SPOTIFY_CALLBACK=XXXXX
SPOTIFY_LINK_CALLBACK=XXXXX
YOUTUBE_CALLBACK=XXXXX
YOUTUBE_LINK_CALLBACK=XXXXX

Could the README be updated to provide example values for the environmental variables (for a dev environment)?

bundit commented 3 years ago

@Otju Updated!

Let me know if anything else is unclear and I'd be happy to answer them and update the README :)

Otju commented 3 years ago

Thanks @bundit!

Seems I did have the right values for those callback-urls, and the problem was actually with the database. Had to mess with my node version and update the pg-package to even get the error message to show up. I got the database connection working, but the login doesn't work cause obviously the database doesn't have the correct tables (it's just an empty database).

Could you provide the database schema (tables and their row names/types) or the SQL-commands used in creating them? The schema could be in the README, or as a separate file. The db could also be initialized in the code when in a dev environment (with CREATE TABLE IF NOT EXISTS or something else).

bundit commented 3 years ago

@Otju ah yeah that makes sense too why it wouldn't be working. I'll leave the db schema here and note to myself to add documentation for this in the future.

CREATE TABLE users (
    id UUID PRIMARY KEY,
    username VARCHAR(255),
    email VARCHAR(255) UNIQUE NOT NULL,
    created_at TIMESTAMP
);

CREATE TABLE user_profiles (
    user_id UUID REFERENCES users(id),
    oauth_provider VARCHAR(255) NOT NULL,
    provider_id VARCHAR(255) NOT NULL,
    refresh_token VARCHAR(255),
    images TEXT,
    username VARCHAR(255),
    "profileUrl" TEXT,
    PRIMARY KEY(user_id, oauth_provider)
);

CREATE TABLE user_playlists (
    user_id UUID REFERENCES users(id),
    source VARCHAR(255) NOT NULL,
    external_id VARCHAR(255) NOT NULL,
    title VARCHAR(255),
    "isConnected" BOOLEAN NOT NULL,
    index SMALLINT NOT NULL,
    img TEXT,
    total INT NOT NULL,
    PRIMARY KEY(user_id, source, external_id)
);

CREATE TABLE keys (
    source VARCHAR(255) NOT NULL,
    type VARCHAR(255) NOT NULL,
    key VARCHAR(255) NOT NULL,
    last_updated TIMESTAMP,
    PRIMARY KEY(source, type)
);

In addition, I think you will need to import the uuid module for creating users. CREATE EXTENSION IF NOT EXISTS 'uuid-ossp';

Let me know if you have any other issues getting it up an running