🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

gitlab-auth

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitlab-auth

GitLab authorized API application Context

0.3.1
latest
Source
npm
Version published
Weekly downloads
62
-6.06%
Maintainers
1
Weekly downloads
 
Created
Source

GitLab Auth helper for React

import { GitlabAuth, useGitlab } from "gitlab-auth";

function App() {
  return (
    <GitlabAuth
      host="https://gitlab.example.com/"
      application_id="xxxx(Application ID setup in your gitlab instance as admin under applications)xxx"
      redirect_uri="http://localhost:3000/auth/"
      scope="api openid profile email"
    >
      <>This is rendered with GitLab access!</>
    </GitlabAuth>
  );
}

To get access to the gitlab API and list branches:

import { useState, useEffect } from "react";
import { useGitlab } from "gitlab-auth";

function BranchesList() {
  const [branches, setBranches] = useState(null);
  const gitlab = useGitlab();
  useEffect(() => {
    gitlab.Branches.all("myprojectname").then((b) => {
      setBranches(b);
    });
  }, [gitlab]);
  return (
    <>
      {branches &&
        branches.map((branch, idx) => {
          <div key={idx}>{branch.name}</div>;
        })}
    </>
  );
}

Keywords

GitLab

FAQs

Package last updated on 06 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts