Socket
Socket
Sign inDemoInstall

gitlab-auth

Package Overview
Dependencies
43
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gitlab-auth

GitLab authorized API application Context


Version published
Weekly downloads
1
decreased by-93.75%
Maintainers
1
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 12 Sep 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc