Skip to content

Commit c30644a

Browse files
committed
Move ENDPOINT.TOKEN to /api/index.ts
1 parent 75982b6 commit c30644a

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

packages/auth/demo/src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,7 +1734,6 @@ function onDelete() {
17341734
var isAppleProviderLinked = false;
17351735

17361736
for (const provider of activeUser().providerData) {
1737-
console.log('provider.providerId: ' + provider.providerId);
17381737
if (provider.providerId == 'apple.com') {
17391738
isAppleProviderLinked = true;
17401739
break;
@@ -1761,7 +1760,6 @@ function revokeAppleTokenAndDeleteUser() {
17611760
provider.addScope('name');
17621761

17631762
const auth = getAuth();
1764-
// TODO: Make this pop up or redirect. Can't use signInWithPopupRedirect because we need `then`.
17651763
signInWithPopup(auth, provider).then(result => {
17661764
// The signed-in user info.
17671765
const user = result.user;

packages/auth/src/api/authentication/token.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import chaiAsPromised from 'chai-as-promised';
2121

2222
import { FirebaseError, getUA, querystringDecode } from '@firebase/util';
2323

24-
import { HttpHeader } from '../';
24+
import { Endpoint, HttpHeader } from '../';
2525
import { testAuth, TestAuth } from '../../../test/helpers/mock_auth';
2626
import * as fetch from '../../../test/helpers/mock_fetch';
2727
import { ServerError } from '../errors';
28-
import { Path, requestStsToken } from './token';
28+
import { requestStsToken } from './token';
2929
import { SDK_VERSION } from '@firebase/app';
3030
import { _getBrowserName } from '../../core/util/browser';
3131

@@ -38,7 +38,7 @@ describe('requestStsToken', () => {
3838
beforeEach(async () => {
3939
auth = await testAuth();
4040
const { apiKey, tokenApiHost, apiScheme } = auth.config;
41-
endpoint = `${apiScheme}://${tokenApiHost}${Path.TOKEN}?key=${apiKey}`;
41+
endpoint = `${apiScheme}://${tokenApiHost}${Endpoint.TOKEN}?key=${apiKey}`;
4242
fetch.setUp();
4343
});
4444

packages/auth/src/api/authentication/token.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ import { FetchProvider } from '../../core/util/fetch_provider';
3232
import { Auth } from '../../model/public_types';
3333
import { AuthInternal } from '../../model/auth';
3434

35-
export const enum Path {
36-
TOKEN = '/v1/token'
37-
}
38-
3935
export const enum TokenType {
4036
UNSPECIFIED = 'TOKEN_TYPE_UNSPECIFIED',
4137
REFRESH_TOKEN = 'REFRESH_TOKEN',
@@ -83,7 +79,7 @@ export async function requestStsToken(
8379
const url = _getFinalTarget(
8480
auth,
8581
tokenApiHost,
86-
Path.TOKEN,
82+
Endpoint.TOKEN,
8783
`key=${apiKey}`
8884
);
8985

packages/auth/src/api/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const enum Endpoint {
6969
GET_PROJECT_CONFIG = '/v1/projects',
7070
GET_RECAPTCHA_CONFIG = '/v2/recaptchaConfig',
7171
GET_PASSWORD_POLICY = '/v2/passwordPolicy',
72+
TOKEN = '/v1/token',
7273
REVOKE_TOKEN = '/v2/accounts:revokeToken'
7374
}
7475

packages/auth/src/core/user/token_manager.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ import { FirebaseError } from '@firebase/util';
2323

2424
import { testAuth, TestAuth } from '../../../test/helpers/mock_auth';
2525
import * as fetch from '../../../test/helpers/mock_fetch';
26-
import { Path } from '../../api/authentication/token';
2726
import { IdTokenResponse } from '../../model/id_token';
2827
import { StsTokenManager, Buffer } from './token_manager';
2928
import { FinalizeMfaResponse } from '../../api/authentication/mfa';
3029
import { makeJWT } from '../../../test/helpers/jwt';
30+
import { Endpoint } from '../../api';
3131

3232
use(chaiAsPromised);
3333

@@ -103,7 +103,7 @@ describe('core/user/token_manager', () => {
103103
let mock: fetch.Route;
104104
beforeEach(() => {
105105
const { apiKey, tokenApiHost, apiScheme } = auth.config;
106-
const endpoint = `${apiScheme}://${tokenApiHost}${Path.TOKEN}?key=${apiKey}`;
106+
const endpoint = `${apiScheme}://${tokenApiHost}${Endpoint.TOKEN}?key=${apiKey}`;
107107
mock = fetch.mock(endpoint, {
108108
'access_token': 'new-access-token',
109109
'refresh_token': 'new-refresh-token',

0 commit comments

Comments
 (0)