fix: turn off permission of GitHub OAuth app fixed #1377

This commit is contained in:
Liyas Thomas
2020-12-10 16:12:38 +05:30
parent 3acb2a56a2
commit bdf72eca70
2 changed files with 9 additions and 9 deletions

View File

@@ -207,7 +207,7 @@ describe("FirebaseInstance", () => {
const fb = new FirebaseInstance(mocksdk, { const fb = new FirebaseInstance(mocksdk, {
github: () => { github: () => {
return { return {
addScope: () => {} addScope: () => {},
} }
}, },
}) })
@@ -224,7 +224,7 @@ describe("FirebaseInstance", () => {
const fb = new FirebaseInstance(mocksdk, { const fb = new FirebaseInstance(mocksdk, {
github: () => { github: () => {
return { return {
addScope: () => {} addScope: () => {},
} }
}, },
}) })
@@ -241,7 +241,7 @@ describe("FirebaseInstance", () => {
const fb = new FirebaseInstance(mocksdk, { const fb = new FirebaseInstance(mocksdk, {
github: () => { github: () => {
return { return {
addScope: () => {} addScope: () => {},
} }
}, },
}) })
@@ -252,15 +252,15 @@ describe("FirebaseInstance", () => {
await expect(fb.signInUserWithGithub()).rejects.toEqual("test error") await expect(fb.signInUserWithGithub()).rejects.toEqual("test error")
}) })
test("adds 'repo gist' scope", async () => { test("adds 'gist' scope", async () => {
const fbFunc = jest.spyOn(mockAuth, "signInWithPopup") const fbFunc = jest.spyOn(mockAuth, "signInWithPopup")
const addScopeMock = jest.fn() const addScopeMock = jest.fn()
const fb = new FirebaseInstance(mocksdk, { const fb = new FirebaseInstance(mocksdk, {
github: () => { github: () => {
return { return {
addScope: addScopeMock addScope: addScopeMock,
} }
}, },
}) })
@@ -270,7 +270,7 @@ describe("FirebaseInstance", () => {
fbFunc.mockImplementation(() => Promise.resolve("test")) fbFunc.mockImplementation(() => Promise.resolve("test"))
await fb.signInUserWithGithub() await fb.signInUserWithGithub()
expect(addScopeMock).toBeCalledWith("repo gist") expect(addScopeMock).toBeCalledWith("gist")
}) })
test("resolves the response the firebase request resolves", async () => { test("resolves the response the firebase request resolves", async () => {
const fbFunc = jest.spyOn(mockAuth, "signInWithPopup") const fbFunc = jest.spyOn(mockAuth, "signInWithPopup")
@@ -278,7 +278,7 @@ describe("FirebaseInstance", () => {
const fb = new FirebaseInstance(mocksdk, { const fb = new FirebaseInstance(mocksdk, {
github: () => { github: () => {
return { return {
addScope: () => {} addScope: () => {},
} }
}, },
}) })

View File

@@ -137,7 +137,7 @@ export class FirebaseInstance {
} }
async signInUserWithGithub() { async signInUserWithGithub() {
return await this.app.auth().signInWithPopup(this.authProviders.github().addScope("repo gist")) return await this.app.auth().signInWithPopup(this.authProviders.github().addScope("gist"))
} }
async signInWithEmailAndPassword(email, password) { async signInWithEmailAndPassword(email, password) {