You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **Note**: Running ember install will automatically install all bower and npm dependencies for ember-osf.
46
+
> **Note**: Running ember install will automatically install many bower and npm dependencies for ember-osf.
35
47
36
48
## Configuration
37
49
50
+
### Specifying configuration information
51
+
38
52
#### local.yml settings
39
53
40
-
This file is structured like:
54
+
If for some reason you don't have a config/local.yml you can generate one. To do this:
55
+
```bash
56
+
ember generate ember-osf
57
+
```
58
+
59
+
Ember-osf needs certain configuration variables to run. This is usually done via a config file structured as follows:
41
60
```yaml
42
-
<backend>:
61
+
OAUTH_SCOPES: osf.full_write
62
+
REDIRECT_URI: http://localhost:4200/login
63
+
43
64
CLIENT_ID: null
44
65
PERSONAL_ACCESS_TOKEN: null
45
-
OAUTH_SCOPES: osf.full_read osf.full_write
46
-
REDIRECT_URI: http://localhost:4200/login
47
66
```
48
67
49
68
You will need to fill out options for each backend you want to use (see 'Running' below).
@@ -53,66 +72,121 @@ uri is correct. If it needs a trailing slash, be sure to include a trailing sla
53
72
54
73
Edit the new file (installed in the config directory) and set:
55
74
- `CLIENT_ID` to the client id of your developer application
56
-
- `PERSONAL_ACCESS_TOKEN`to the newly generated token (Only required or recognized for the LOCAL backend; do not set this value for staging, production, or test backends)
57
-
- REDIRECT_URI: Must exactly match the redirect URI used to register the OAuth developer application.
75
+
- `PERSONAL_ACCESS_TOKEN`to the newly generated token (Only required or recognized for the LOCAL backend; do not set
76
+
this value for staging, production, or test backends)
77
+
- `REDIRECT_URI`: Must exactly match the redirect URI used to register the OAuth developer application.
58
78
Default value is appropriate for local development using `ember server`, with a login page at `/login`
59
79
60
-
Because of the potential for this file to include sensitive information, we strongly recommend adding this file to
61
-
`.gitignore`for your project.
80
+
Because of the potential for this file to include sensitive information, **we strongly recommend adding this file to
81
+
`.gitignore`** for your project.
62
82
63
-
#### Using the Test API
83
+
#### Alternate option: Environment variables
84
+
If you do not wish to use file-based configuration, any of the settings above can be overridden individually as
85
+
environment variables with the same name as appears in the config file. Eg
64
86
65
-
To do this, you will need to [create a developer application](https://test.osf.io/settings/applications/) on the relevant version of the OSF.
87
+
`BACKEND=test CLIENT_ID=gibberish ember server`
66
88
67
-
#### Running the OSF Locally (optional)
89
+
If you provide a setting in both the config file and an environment variable, the environment variables take precedence.
68
90
69
-
For local development, you will need to be running the [OSF APIv2](https://github.com/CenterForOpenScience/osf.io#running-the-api-server).
70
-
To connect to the APIv2 while using [fakecas](https://github.com/CenterForOpenScience/osf.io#running-the-osf), you will need to generate a
71
-
personal access token on your local OSF instance [here](http://localhost:5000/settings/tokens/)--go ahead and grant access to all scopes.
91
+
You can always override auth-related settings, but attempts to override server URLs will be ignored unless you
92
+
explicitly specify `BACKEND=env` (see "Running" for example).
72
93
73
-
#### Create a local settings file
94
+
### Using the API
95
+
Most apps that use this addon will authorize requests via OAuth2. As may be apparent from the `CLIENT_ID` and
96
+
`REDIRECT_URI`settings above, you will need to [create a developer application](https://test.osf.io/settings/applications/)
97
+
on the relevant version of the OSF, and provide the appropriate settings for your app.
74
98
75
-
If for some reason you don't have a config/local.yml you can generate one. To do this:
76
-
```bash
77
-
ember generate ember-osf
99
+
### Advanced usage: Selecting an authorization type
100
+
We expect that most projects based on `ember-osf` will authenticate via OAuth 2.0 ("Token Login"); the addon is
101
+
configured to use this out of the box, so long as you provide your own login page based on the appropriate mixins.
102
+
This is the most effective way for third-party applications to work with our services.
103
+
104
+
If you are developing an application that will be hosted under the `osf.io` domain, you may wish to use cookie-based
105
+
authentication instead. In that rare case, add the following lines to your `config/environment.js` file:
0 commit comments