mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
4dd89b14d2
* add gitlab oauth provider and ui * add gitlab remaining * add graphql field in query * add gitlab oauth provider and ui * add gitlab remaining * add graphql field in query * add some changes for testing * add gitlab oauth provider and ui * add gitlab remaining * add graphql field in query * add some changes for testing * add some changes * modify test * try to refresh the token on git auth failure * use localStorage to retrieve the session token * simplify e2e tests for gitlab * read the gitlab config from the api * refresh the token if unauthorised * use the rest api to fetch the user's data * add loading state for config and handle 4xx errors in the ui Co-authored-by: jackkav <jackkav@gmail.com> * improve config fetching * fix(e2e): add mock route for config * Fix fetching gitlab config from the API * add src as dep to avatar component hook Co-authored-by: Mark Kim <yowmark613@gmail.com> Co-authored-by: jackkav <jackkav@gmail.com> Co-authored-by: David Marby <david@dmarby.se>
40 lines
1003 B
TypeScript
40 lines
1003 B
TypeScript
import type { Application } from 'express';
|
|
|
|
export default (app: Application) => {
|
|
app.post('/gitlab-api/api/graphql', (_req, res) => {
|
|
res.status(200).send({
|
|
'data': {
|
|
'currentUser': {
|
|
'publicEmail': null,
|
|
'name': 'Mark Kim',
|
|
'avatarUrl': null,
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
app.get('/api/v1/oauth/gitlab/config', (_req, res) => {
|
|
res.status(200).send({
|
|
applicationId: 'gitlab-oauth-client-id',
|
|
redirectUri: 'http://localhost:3000/not-implemented',
|
|
});
|
|
});
|
|
|
|
app.post('/gitlab-api/oauth/token', (_req, res) => {
|
|
res.status(200).send({
|
|
'access_token': '123456789',
|
|
'created_at': 1652246628,
|
|
'expires_in': 6955,
|
|
'refresh_token': '1234567891',
|
|
scope: 'api read_user write_repository read_repository email',
|
|
'token_type': 'Bearer',
|
|
});
|
|
});
|
|
|
|
app.post('/gitlab-api/oauth/authorize', (_req, res) => {
|
|
res.status(200).send({
|
|
'access_token': '123456789',
|
|
});
|
|
});
|
|
};
|