-
Notifications
You must be signed in to change notification settings - Fork 25
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
Can not get two-legged auth to work #49
Comments
Did you associate this photon ID with your product in console? |
Ohh..., as I have said - stupid mistake. It works now! Thanks, I would have never figured this out by myself - I guess it might be worth noting this somewhere in the documentation for two-legged auth process. |
Hi @Shaninnik @idokleinman i am working on two -legged auth recently too. May i ask did you use SPK SDK methods or your own POST/GET to shadow customer? If i follow the document the server side after create the user then generate (shadow) customer* by adding no_password field like below.
Then as i get the access_token on server which used to generate claim code, but when i just use this access_token to generate claim code as document: I got:
How should i do for the activation code? I see on IOS SDK said Just wondering should i use IOS SDK methods or my own if make shadow customer on IOS part if possible? I see a method: I guess this method can't be used for shadow customer? Because Short of lost. I am very appreciate it for any hints! Thank you! |
Hi @williamhqs The back-end part is very straightforward, no Spark SDK on server side, just plain POST requests. On user registration I also create shadow customer in the Particle Cloud:
And return access_token to the iOS app. Once returned in the iOS app I use
Also I use OAuth2 for authentication internally, so every time I refresh my own access toke, I also do Particle access token refresh by calling
And re-injecting new token after. That is all, all requests in Spark SDK will be authenticated if token was injected successfully. Everything else, apart from access token generation/refreshing is done on the iOS side using Spark SDK. |
HI @Shaninnik Thank you for your response on time and sorry just have time today to continue on this then reply to you late : ) I get the token. I got the error. How about you?
Thank you! EIDT |
Sorry to bring back such an old issue but I seem to be experiencing the same problem and I tried the keychain fix above and that did not help. I can open a new issue if that makes more sense. I am attempting to do two-legged authentication as well and the app makes it all the way through the setup process and fails on the Verify device ownership step. At this point the status LED is "breathing cyan" (not sure if its slowly or normally). At this point I have an oAuth client tied to my product, my server requests an access token and sends it to the iOS app and I call The iOS app logs show the following information during the setup process:
Once it gets to the verify device ownerships step, I see these logs:
It would be great to be able to get a resolution to this issue. Let me know if there is anything I can try or any additional debug information I can provide. |
I am trying to setup two-legged device connection process for iOS app that I am developing, but connection always fails on the last step: Verify device ownership. I was able to successfully create shadow customer (https://docs.particle.io/reference/api/#create-a-customer---client-credentials), update it's oauth token (https://docs.particle.io/reference/api/#generate-a-customer-scoped-access-token), inject token with injectSessionAccessToken, but no matter what I do next, it always fails at Verify device ownership. Also after connecting to Photon Wi-Fi it gives me product ownership alert: "....do you want to override ownership to (null)?" so I guess there may be some issues with authentication.
If I use my regular particle account instead of the two-legged token everything works just fine.
I think that I have made a very stupid mistake somewhere, but can't understand where to look at...
The text was updated successfully, but these errors were encountered: