I've been facing troubles trying to authenticate with OAuth (GitHub and Gitlab). I dont know what i am missing so any help would be appreciated and it would be really helpful if someone could provide an example
- When trying to authenticate with Github I either get this error ''Error 400 Invalid success: URL host must be one of: localhost, cloud.appwrite.io, *.vercel.app" or when i leave out the success parameter to be empty "Missing Redirect URL"
- With Gitlab iI get directed to appwrite cloud which throws a 404 and takes me to my appwrite dashboard instead of taking me to the Gitlab's OAuth page.
"use client";
import { account } from "@falcon-z/app/utils/appwrite";
export default function LoginButton({
provider,
}: {
provider: "github" | "gitlab";
}) {
const handleAuth = (provider: "github" | "gitlab") => {
account.createOAuth2Session(provider, "localhost:3000/");
};
return (
<button
type="button"
onClick={() => handleAuth(provider)}
>
Login With <span className="first-letter:uppercase">{provider}</span>
</button>
);
}
That url you have is not a url. It's missing http://
What's the URL you put in gitlab?
Thanks, it works for Github
On Gitlab you could find my Appwrite setup on the image above i did copy the ID and secret properly from GItlab double checked them. I dont understand what the endpoints field is so i tried leaving it blank filled in with some GItlab APi endpoints no matter what when i click on login dashboards from my app i am being taken to Appwrite's cloud displaying a 404 page not found which immediately redirects to my Appwrite dashboard
its the same Localhost URL for gitlab on my code only the provider changes depending on the props passed in to the component
No I mean the redirect URL that you put in gitlab
The endpoint should be gitlabs endpoint. If youre using gitlab cloud, it should be left blank
I used the URI shown on appwrite console when setting up on the pic
K the problem is probably the endpoint you put
i guess so , i actually dont use gitlab much and i just wanted to provide an option for users to login with gitlab . I tried leaving endpoints field empty and the same thing happened
Try putting https://gitlab.com
I actually don't know gitlab's url...do you?
Actually that's probably right. For some reason, I thought it was gitlab.io
😀 that works thanks
i get this error though after authorizing on gitLab "Cannot assign null to property Appwrite\Auth\OAuth2\Gitlab::$user of type array"
you got it right its gitlab.com
Unable to get the user for some reason. You sure everything is configured correctly between the two? Like the client Id and secret?
yeah i think so, ill stry configuring things again to be sure
i renewed client secret checked the ID and redirect URI everything seems to be set up right
JSON decoding is resulting in null for some reason. Here: https://github.com/appwrite/appwrite/blob/181741d7a2082f5c9d3ca727384601f3cf75e5bf/src/Appwrite/Auth/OAuth2/Gitlab.php#L167
Recommended threads
- Got message for auto payment of 15usd fo...
how did this happen? 1. i claimed my 50usd credits via jsm hackathon - https://hackathon.jsmastery.pro/ 2. it asked me which org. to apply the credits on, i se...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...