How to link your GitLab account to StackEdit?
Tags: gitlab, stackedit
Published: 2019-12-14 16:02:08

First. Go to the [StackEdit](https://stackedit.io/) and click in "Start Writing".

![Step 1](https://thepracticaldev.s3.amazonaws.com/i/rnkgsn6mzsc1ayxsf3xm.png)

After waiting for StackEdit to load, this should be waiting for you.

Just click "Skip" because we don't need a tutorial on how StackEdit works for now.

![Step 2](https://thepracticaldev.s3.amazonaws.com/i/5rxk70ms1zrruz2qe32h.png)

Then go to the StackEdit logo located at the top right and click on it.

![Step 3](https://thepracticaldev.s3.amazonaws.com/i/faatv62mjmt24xsqry1d.png)

This should appear to you.

Just click on "Workspaces". We'll talk about "Sign in with Google" later in this post.

![Step 4](https://thepracticaldev.s3.amazonaws.com/i/8fhuvl9cmv3ifmlfendl.png)

Click in "Add a **GitLab** workspace".

![Step 5](https://thepracticaldev.s3.amazonaws.com/i/8xvhtnoqry6tqlv9fkrh.png)

This should appears to you.

![Step 6](https://thepracticaldev.s3.amazonaws.com/i/4ju6dc5ciqcr1jugbc9z.png)

Now, you need go to the [GitLab](https://gitlab.com/). There, click in your profile icon on top right corner.

> Top right corner is the latest fashion trend! 😉

![Step 7](https://thepracticaldev.s3.amazonaws.com/i/ch3ohle527oq2slzgv3b.png)

This should appears to you.

Just click in "Settings".

![step 8](https://thepracticaldev.s3.amazonaws.com/i/jcmav6c4moxyjj19tlmg.png)

This should appears to you.

Click in "Applications".

![Step 9](https://thepracticaldev.s3.amazonaws.com/i/vq4dqbz1kahv8z92m25q.png)

Under "Add new application", in "Name", well, type a name for your application. Something like "StackEdit" (duh) is fine. I will type "StackEdit2" because I already made this.

![Step 10](https://thepracticaldev.s3.amazonaws.com/i/oijveq3xtm0lyrx5tjfo.png)

In "Redirect URI", type `https://stackedit.io/oauth2/callback`.

![Step 11](https://thepracticaldev.s3.amazonaws.com/i/vvno1tsypj8bgmnvhiq8.png)

> Why? 🤨

Well, StackEdit said this was your Redirect URI.

> Where? 🤨

Here.

![Step 11-Why](https://thepracticaldev.s3.amazonaws.com/i/hizan5ifphoz2w0o2gvm.png)

Then, check the box "api".

Of course, you can check all the boxes you want.

This is not gonna break StackEdit.

But StackEdit will only need the "api" box. 

And checking checkboxes beyond the "api" box is dangerous.

Because that will give more permission than StackEdit needs.

And then, if a bad person ends up having access to your application ID and all, they can do much more than simply commit to one of your repositories.

***Like I said, It is recommended that you only check the "api" checkbox.***

![Step 12](https://thepracticaldev.s3.amazonaws.com/i/5olbaf3d7mh9a4ydcz82.png)

Now, scroll down unitl the "Save application" button, and click on him.

As you see, I already have a application called "StackEdit" so this is why I called this "StackEdit2", like I said before.

![Step 13](https://thepracticaldev.s3.amazonaws.com/i/udb9sl2j5faexj68h1ol.png)

This should appears...

Copy the "Application ID" code from GitLab to the "Application ID" field in the StackEdit.

![Step 14](https://thepracticaldev.s3.amazonaws.com/i/qsbrtxhgqpf4y08hktn8.png)

![Step 15](https://thepracticaldev.s3.amazonaws.com/i/fxmxee1656j27zsszi9z.png)

> Wait, why don't cover up your code? This is dangerous?

Yes it is. But I will delete the app after doing this tutorial, so I think it's okay as it won't be valid anymore.

> If you say 😐

Now you will get the URL of the page where the Application ID was and paste it into the "GitLab URL" field.

I'm not gonna give you guys a screenshot, because my tabs are... A little... Private... 😅

> Your dirty furry 😏

It's something like: `https://gitlab.com/oauth/applications/146425`.

![Step 16](https://thepracticaldev.s3.amazonaws.com/i/hto2h195oz34gk0emztq.png)

Now click in the "OK" button. When you click the "OK" button, it will open a page like this...

![Step 18](https://thepracticaldev.s3.amazonaws.com/i/dm6bejits09qh3ybcbk5.png)

Just click in "Authorize" button.

![Step 19](https://thepracticaldev.s3.amazonaws.com/i/bl36cl6e5jrnbj2oxf4y.png)

Ta-dah! Now everything is set up! It will return to StackEdit and ask for a repository name. Now. Every time you edit or create a Markdown file within StackEdit, it will be committed into the repository you have chosen.

> Didn't you say you would explain about "Sign in with Google"? 😶

Oh! Yes! Of course! It's simple!

"Signing in with Google" will cause StackEdit to store your credentials and create a workspace for you. That way, you don't have to "do everything you do here" every time you restart StackEdit or delete your cookies. However, the Google workspace cannot be accessed from anywhere other than StackEdit. Unlike GitLab, where you can access your files both from the GitLab repository you choose, as well as from StackEdit.

That's it!

***Thanks for reading and a fun fact: You known the red fox likes the white wolf?***