2018-01-24 15:21:52 +00:00
|
|
|
/**
|
|
|
|
* @flow
|
|
|
|
* OAuthProvider representation wrapper
|
|
|
|
*/
|
|
|
|
import type { AuthCredential } from '../types';
|
|
|
|
|
|
|
|
const providerId = 'oauth';
|
|
|
|
|
|
|
|
export default class OAuthProvider {
|
|
|
|
constructor() {
|
2018-01-25 18:25:39 +00:00
|
|
|
throw new Error(
|
|
|
|
'`new OAuthProvider()` is not supported on the native Firebase SDKs.'
|
|
|
|
);
|
2018-01-24 15:21:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static get PROVIDER_ID(): string {
|
|
|
|
return providerId;
|
|
|
|
}
|
|
|
|
|
|
|
|
static credential(idToken: string, accessToken: string): AuthCredential {
|
|
|
|
return {
|
|
|
|
token: idToken,
|
|
|
|
secret: accessToken,
|
|
|
|
providerId,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|