[js][iid] getToken & deleteToken now have option args with defaults that use `app.options.messagingSenderId` as authorizedEntity and '*' as scope
This commit is contained in:
parent
947825c8ee
commit
aa12de3248
|
@ -7,8 +7,8 @@ import { getNativeModule } from '../../utils/native';
|
|||
|
||||
import type App from '../core/app';
|
||||
|
||||
export const MODULE_NAME = 'RNFirebaseInstanceId';
|
||||
export const NAMESPACE = 'iid';
|
||||
export const MODULE_NAME = 'RNFirebaseInstanceId';
|
||||
|
||||
export default class InstanceId extends ModuleBase {
|
||||
constructor(app: App) {
|
||||
|
@ -20,20 +20,51 @@ export default class InstanceId extends ModuleBase {
|
|||
});
|
||||
}
|
||||
|
||||
delete(): Promise<void> {
|
||||
return getNativeModule(this).delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current Instance ID.
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
get(): Promise<string> {
|
||||
return getNativeModule(this).get();
|
||||
}
|
||||
|
||||
getToken(authorizedEntity: string, scope: string): Promise<string> {
|
||||
return getNativeModule(this).getToken(authorizedEntity, scope);
|
||||
/**
|
||||
* Delete the current Instance ID.
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
delete(): Promise<void> {
|
||||
return getNativeModule(this).delete();
|
||||
}
|
||||
|
||||
deleteToken(authorizedEntity: string, scope: string): Promise<void> {
|
||||
return getNativeModule(this).deleteToken(authorizedEntity, scope);
|
||||
/**
|
||||
* Get a token that authorizes an Entity to perform an action on behalf
|
||||
* of the application identified by Instance ID.
|
||||
*
|
||||
* @param authorizedEntity
|
||||
* @param scope
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
getToken(authorizedEntity?: string, scope?: string): Promise<string> {
|
||||
return getNativeModule(this).getToken(
|
||||
authorizedEntity || this.app.options.messagingSenderId,
|
||||
scope || '*'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Revokes access to a scope (action) for an entity previously authorized by getToken().
|
||||
*
|
||||
* @param authorizedEntity
|
||||
* @param scope
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
deleteToken(authorizedEntity?: string, scope?: string): Promise<void> {
|
||||
return getNativeModule(this).deleteToken(
|
||||
authorizedEntity || this.app.options.messagingSenderId,
|
||||
scope || '*'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue