-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
credentials not available via listener after authentication #3
Comments
This is the code I have at the moment: function startSpark() {
|
This is the output I get: spark.html:37 xxxxxxxxxxx starting spark xxxxxxxxxxx |
After the 'credentials: received authorization' I am unable to get my access_token and I am not authenticated. |
ok, i think you've stumbled across several subtle bugs. Can you change function initSpark() {
console.log('initializing spark');
return new ciscospark.init({
credentials: credentials,
device: device,
config: {
credentials: {
clientType: 'confidential',
oauth: {
client_id: client_id,
client_secret: client_secret,
scope: scope,
redirect_uri: redirect_uri
}
}
}
});
} |
I tried clientType 'confidential' before too. The output is: Navigated to http://localhost:5555/spark.html |
Before when I tried this, I could get rid of the 400 error by removing the auth from the POST request and adding the client_id, client_secret and redirect_uri. |
can you try generating your bundle with the following environment variables set? (and pass nothing to the config hash)
|
Also, did you explicitly install 0.7.0 or did npm install it automatically? According to semver, 0.7.0-* should be prerelease versions that you have to explicitly opt into (and they may or may not be ready yet) |
I build the bundle of master, version fa143e5 now. |
I see. Building master is potentially dangerous, especially right now (i'm working on setting up tooling to make sure master always passes all tests, but at the moment, many tests are disabled). You should use the latest stable version from npm: |
using the environment vars and only passing clientType to the init works the same as before. Navigated to http://localhost:5555/spark.html |
I know in step: 'requesting authorization code grant' the POST gets done, but after that the token is not handled. |
ah, ok. I couldn't get the npm package build, but I have checked the version c49ca68 out and I will try this. |
This gives the same result. After I get the code this is the output: spark.js:36988 credentials(shim): updating browser location http://localhost:5555/spark.html |
ok. i have a guess: try this: function initSpark() {
console.log('initializing spark');
Object.assign(ciscospark.config.credentials.oauth, {
client_id: client_id,
client_secret: client_secret,
scope: scope,
redirect_uri: redirect_uri
});
return ciscospark;
} I'm going to have to think about a proper solution a bit more, but I'm completely aware this area needs some cleanup. |
Ok, this sounds plausible.
|
this seems to work! :-) the only thing I am missing is the loading of the credentials. How do I pass the credentials and device in the initSpark function? |
I managed to get the credentials working. |
@Popl7 glad you got it figured out! I've opened issues for the (what i believe to be) all of the causes of the confusion. |
poke into the right part of the user object
Merging latest master
when using the JS bundle I am unable to get my credentials.
The authentication to the oAuth works and I do receive an access_token.
I would like to persist this.
The text was updated successfully, but these errors were encountered: