NgxGlobusSdk is a library that enables you to easily work with Globus and its APIs. So far, the SDK only allows interaction with the Auth and Transfer APIs.
This project was generated with Angular CLI version 13.3.5.
Install from the command line:
npm install @usnistgov/ngx-globus-sdk@0.0.1
Install via package.json
:
"@usnistgov/ngx-globus-sdk": "0.0.1"
Import the the NgxGlobusSdkModule
module and add it to your app.module.ts
imports:
import { NgxGlobusSdkModule } from 'ngx-globus-sdk';
@NgModule({
...
imports: [
...
NgxGlobusSdkModule.forRoot({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
...
})
],
...
})
export class AppModule {
}
then import the NgxGlobusSdkService
service, and inject it into a constructor:
import { NgxGlobusSdkService } from 'ngx-globus-sdk';
...
constructor(private globusService: NgxGlobusSdkService)
{
...
let authUrl = this.globusService.getAuthorizeUrl();
...
}
The module expects the following configuration interface:
export interface Configuration {
clientId: string;
clientSecret: string;
redirectUrl: string;
scope?: string;
authorizeUrl?: string;
tokenUrl?: string;
}
where:
clientId
, andclientSecret
are provided by Globus when first registering and creating the app. These should be hidden in env variables.redirectUrl
is the url to redirect the user to after a login. This is specified by the app developer during app creation and registration.scope
the scopes that the app has access to. Defaults to "openid profile email".authorizeUrl
is the OAuth2 authorization endpoint. Defaults to "https://auth.globus.org/v2/oauth2/authorize".tokenUrl
is the endpoint used to exchange an authorization code for an access token. Defaults to "https://auth.globus.org/v2/oauth2/token".
- Download from Globus using https is not working. This might not be supported by Globus. To check.
Check CONTRIBUTING.md
Check LICENSE