Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boilerplate OAuth website <=> inference #2127

Merged
merged 2 commits into from Mar 20, 2023
Merged

Boilerplate OAuth website <=> inference #2127

merged 2 commits into from Mar 20, 2023

Conversation

AbdBarho
Copy link
Collaborator

@AbdBarho AbdBarho commented Mar 19, 2023

Refs #2101

Use the website's backend as a callback url for login to discord and github, so that the website also knows the token.

To use this, you need to configure your discord oauth provider to use the url: http://localhost:3000/api/inference_auth/discord, I used the same provider I use for logging in to the website and it worked like a charm.

github also: http://localhost:3000/api/inference_auth or http://localhost:3000/api/inference_auth/gihtub, both should work since github allows sub paths.

you need to set these 4 env variables for the inference server:

AUTH_DISCORD_CLIENT_ID
AUTH_DISCORD_CLIENT_SECRET

AUTH_GITHUB_CLIENT_ID
AUTH_GITHUB_CLIENT_SECRET

then you can navigate to

localhost:8000/auth/login/github
localhost:8000/auth/login/discord

@LAION-AI LAION-AI deleted a comment from github-actions bot Mar 19, 2023
@LAION-AI LAION-AI deleted a comment from github-actions bot Mar 19, 2023
Copy link
Collaborator

@olliestanley olliestanley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the required inference backend changes for this!

Copy link
Collaborator

@yk yk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing, thank you!

Copy link
Collaborator

@notmd notmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

const [provider] = parts as string[];
const url = process.env.INFERENCE_SERVER_HOST + `/auth/callback/${provider}?code=${code}`;
const { data } = await axios<InferenceTokenResponse>(url);
console.log(data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(data);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is not currently used anywhere, so I left the console log for debugging purposes, I will remove it in the next PR when I integrate it into the API requests.

@AbdBarho AbdBarho merged commit b1f37f9 into main Mar 20, 2023
4 checks passed
@AbdBarho AbdBarho deleted the oauth-web-inference branch March 20, 2023 06:10
@notmd notmd mentioned this pull request Mar 20, 2023
AbdBarho pushed a commit that referenced this pull request Mar 20, 2023
It was fixed in #2127 but due to a bad merge at #2134 caused the
regression, sorry for this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants